how to know the column/row of a selected cell in vba?

D

daryl

How can i determine in VBA the rows OR column (not the address) of
selected cell?

if the selected cell is J20, i want to have a separate value assigne
for x_col = 10 and y_row = 20

thank you for the hel
 
E

Edwin Tam

x_col = Selection.cells(1).colum
y_row = Selection.cells(1).ro


----- daryl > wrote: ----

How can i determine in VBA the rows OR column (not the address) of
selected cell

if the selected cell is J20, i want to have a separate value assigne
for x_col = 10 and y_row = 2

thank you for the hel
 
C

Chris

I have a question relating to the original post: How do you change
the active cell using VBA? In other words if the cellpointer is in
G10, how can I move it to G11?
 
J

JE McGimpsey

One way:

Range("G11").Activate

another:

ActiveCell.Offset(1, 0). Activate

A third:

ActiveCell(2, 1).Activate
 
Top