-
If Statement Excel Macro
Through the use of an Excel macro If Statement, I want to be able to analyze the current cell position and depending on the cell position have the macro move the cursor. This is the statement that I wrote but does not seem to work. It skips to the end if and does not perform the command.
If ActiveCell = "$A$2" Then
'Application.Goto Reference:="R10C1"
End If
-
Hello Bob,
Try using A1 style references throughout your macro. You don't need Application.GoTo. You can move to a cell simply by selecting it.
Code:
If ActiveCell.Address = "$A$2" Then
Range("$A$10").Select
End IF
-
Leith,
Thank you so much. That worked great!
-
Hello Bob,
You're welcome.
-
Leith,
Can you tell me how to check for a blank cell. Sorry, this is my first attempt at Excel macros so I am a bit novus. Below is what I am trying but it is no working. Again it is skipping to the End If. Thank you
If ActiveCell.Address = "" Then
ActiveCell.FormulaR1C1 = "1"
End If
-
Leith,
I figured it out
Set rRng = Sheet1.Range("A3")
If IsEmpty(rRng.Value) Then
-
Hello Bob,
Good work for a novice.
-
Yea, that's the best way to learn
You can mark your question solved by using [Tread Tools] about your first post, and selection [Solved]
-
Thanks everyone. This is a fantastic website. Paul I will mark as solved through thread tools but I not sure how to do that. Thanks
-
1 Attachment(s)