macro to move cursor

  • Thread starter Thread starter Bob S
  • Start date Start date
B

Bob S

I need a macro that will move the cursor to the first
blank cell in column A greater than A5. I want to put it
in the "open" procedure for the worksheet to prevent the
need to scroll down to it manually

Thanks Bob
 
Trevor,
Thanks for the quick response. My knowledge of writing
macros in limited. I inserted it into a macro but I get a
run time error with the following

Sub Macro1()

Range("A5").End(xlDown).Offset(1, 0).Select

End Sub

I have obviously left something out !

Bob
 
Bob

Sub test()
Range("A5").End(xlDown).Offset(1, 0).Select
End Sub

This assumes there is something in at least one of the cells below A5,
otherwise it will go to the last row in the sheet and try to offset from
there ... which gives you error 1004

Try this:

Sub Test()
On Error GoTo NoCells
Range("A5").End(xlDown).Offset(1, 0).Select
Exit Sub
NoCells: Range("A5").Select
End Sub

Sorry; had assumed there would be something in those cells

Regards

Trevor
 
Thanks Trevor !


-----Original Message-----
Bob

Sub test()
Range("A5").End(xlDown).Offset(1, 0).Select
End Sub

This assumes there is something in at least one of the cells below A5,
otherwise it will go to the last row in the sheet and try to offset from
there ... which gives you error 1004

Try this:

Sub Test()
On Error GoTo NoCells
Range("A5").End(xlDown).Offset(1, 0).Select
Exit Sub
NoCells: Range("A5").Select
End Sub

Sorry; had assumed there would be something in those cells

Regards

Trevor





.
 
Back
Top