I am new to VBA. Firstly, the function that I have is :
Function SumNums(pWorkRng As Range, Optional xDelim As String = " ") As Double
Dim arr As Variant
Dim xIndex As Long
arr = Split(pWorkRng, xDelim)
For xIndex = LBound(arr) To UBound(arr) Step 1
SumNums = SumNums + VBA.Val(arr(xIndex))
Next
End Function
Using this, from a cell (etc. F9) filled with characters, 1 White & 2 Red, excel can read 3. However, I need to connect with my other function which based on the value calculated on the same cell (F9), it does the number of times of clicks.
Private Sub CommandButton1_Click()
With Me.CommandButton1
.Tag = Val(.Tag) + 1
If .Tag = SumNums.Cells(9, 6).Value Then
rows(9).Interior.ColorIndex = 10
.Tag = 0
End If
End With
End Sub
But the code ^ there don't work. I also want the row that excel reads to be automatically colour index = 10. Instead of me specifying rows(9).
Thankss.
Function SumNums(pWorkRng As Range, Optional xDelim As String = " ") As Double
Dim arr As Variant
Dim xIndex As Long
arr = Split(pWorkRng, xDelim)
For xIndex = LBound(arr) To UBound(arr) Step 1
SumNums = SumNums + VBA.Val(arr(xIndex))
Next
End Function
Using this, from a cell (etc. F9) filled with characters, 1 White & 2 Red, excel can read 3. However, I need to connect with my other function which based on the value calculated on the same cell (F9), it does the number of times of clicks.
Private Sub CommandButton1_Click()
With Me.CommandButton1
.Tag = Val(.Tag) + 1
If .Tag = SumNums.Cells(9, 6).Value Then
rows(9).Interior.ColorIndex = 10
.Tag = 0
End If
End With
End Sub
But the code ^ there don't work. I also want the row that excel reads to be automatically colour index = 10. Instead of me specifying rows(9).
Thankss.