View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob S[_2_] Bob S[_2_] is offline
external usenet poster
 
Posts: 3
Default macro to move cursor

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


"Bob S" wrote in

message
...
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




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

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

Regards

Trevor


"Bob S" wrote in

message
...
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


.



.