ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to move cursor (https://www.excelbanter.com/excel-programming/287935-macro-move-cursor.html)

Bob S[_2_]

macro to move cursor
 
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 Shuttleworth

macro to move cursor
 
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




Bob S[_2_]

macro to move cursor
 
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



.


Trevor Shuttleworth

macro to move cursor
 
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



.




Bob S[_2_]

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


.



.



All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com