mikecox39
Active Member
- Joined
- Mar 5, 2014
- Messages
- 251
- Office Version
- 365
- Platform
- Windows
I copied this code from Excel VBA: by Nein Smith and I can't get it to work.
The data is a mixed list of number from 1-10 in Column A, color line works but the text line does not
I know there should be a Then in this macro to the author was just trying to show how Conditional logic works, at a very basic level. I guess he thought add the Then part would just cause confusion.
I'm sure there is a simple answer but I don't see it. I understand this is an Offset operation and that it's working in the second line, but why isn't it working in the first line? I expect that it is and that the issue has something to do with the text variable.
The data is a mixed list of number from 1-10 in Column A, color line works but the text line does not
I know there should be a Then in this macro to the author was just trying to show how Conditional logic works, at a very basic level. I guess he thought add the Then part would just cause confusion.
I'm sure there is a simple answer but I don't see it. I understand this is an Offset operation and that it's working in the second line, but why isn't it working in the first line? I expect that it is and that the issue has something to do with the text variable.
Code:
Sub DataSet1() Dim FirstNumber As Integer
FirstNumber = ActiveCell.Value
If FirstNumber >= 5 Then
ActiveCell(1, 2).Value = ”Completed”
ActiveCell(1, 1).Interior.Color = RGB(225, 225, 0)
End If
End Sub