Question

This is probably very simple for those in the know! I would like to know what code I should use when writing a macro to enable me to move my cursor to by clicking a control button to a specific column within my worksheet. To be more precise: I would like to be able to click this button when my cursor is positioned anywhere within the worksheet and have it take me straight to my chosen column, but to the cell in the same row that my cursor is positioned when I click it. As examples: if my cursor is positioned in let's say cell H5, I would like that when I click my control button my cursor is moved directly to cell Z5 or if it is positioned in G26 it is moved directly to cell Z26 and so on and so forth. Many thanks in advance for any assistance with this :)

Was it helpful?

Solution

For example, column Z

Assign this macro to your button:

Sub JumpThere()
    Dim col As String
    col = "Z"
    Range(col & ActiveCell.Row).Select
End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top