PDA

View Full Version : Syntax for Set_Cursor_Pos()



simonc64
10-11-2012, 05:08 AM
Hi all, im a newbie to VBA and the site but hoping you can help me!

I am aware of the Set_Cursor_Pos() command but what I am trying to do (and failing so far!) is to force the cursor to the last non blank cell in column C of a worksheet on the press of of a button. I can make the button and know how to attach the code, its just the code i cant fathom!

can it be done please?

Cheers

Simon

snb
10-11-2012, 05:33 AM
Private Sub Commandbutton1_click()
application.goto sheets("sheet1").cells(rows.count,3).end(xlup)
end sub

simonc64
10-11-2012, 05:42 AM
thank you so much snb ! works a treat !

If you have time it would be cool to understand how and why this works to help my fill my knowledge gap!

snb
10-11-2012, 08:55 AM
I think the best explanation you will find in the VBEditor's helpfiles. lemmata:
- goto
- cells()
- end()