這是關於另一篇文章的問題。如何在計算中包含小數
我寫了一個代碼執行以下操作:
這將需要數x,然後找到在數據集是14,28,42,56開等每個數字。 我使用下面顯示的原始代碼的問題是,它沒有考慮到相隔13.99或13.55的那些值。不知道如何添加標準來解決這個問題。我的代碼適用於整數,但不適用於小數:
Sub GetPairs()
Dim x, z As Single
Dim lastRow, pasterow As Single
Dim testMass, nomMass As Single
Dim lastValue As Long
Dim colCounter As Long
Dim lookUpRange As Range
lastRow = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
lastValue = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Value
Set lookUpRange = Worksheets(1).Range("B2:B" & lastRow)
pasterow = 2
For x = 2 To lastRow
nomMass = Cells(x, 2).Value
colCounter = 3
For z = Round((nomMass + 14), 0) To Round((lastValue + 14), 0) Step 14
If Found(lookUpRange, z) Then
'found
Worksheets(1).Cells(x, colCounter) = z
colCounter = colCounter + 1
End If
Next z
Next x
End Sub
是否有可能獲得加強功能來加強btw(13.5-14)?升壓功能是否必須設置爲整數? – 2014-08-29 17:06:05