I'm working with a table and an user-defined variable that may or may not exist in column A. If it does exist, I need to be able to select that cell. If it doesn't exist, I need to enter the user-defined variable into the cell. I think an If/Then/Else statement should work, but I can't开发者_StackOverflow figure out how the syntax would work.
Lance was on the right path, but I think he made a small error. If I understand you correctly, the following will do what you need:
If rngCell.Value = userVariable Then
rngCell.Select
Else
rngCell.Value = userVariable
End If
Here's one way:
IF userCell <> "" Then
userCell.Select
Else
userCell = userVariable
End If
精彩评论