ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to know the column/row of a selected cell in vba? (https://www.excelbanter.com/excel-programming/297270-how-know-column-row-selected-cell-vba.html)

daryl

how to know the column/row of a selected cell in vba?
 
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

--
Message posted from http://www.ExcelForum.com


JE McGimpsey

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

x_col = ActiveCell.Column
x_row = ActiveCell.Row

In article ,
daryl wrote:

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

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

thank you for the help


---
Message posted from http://www.ExcelForum.com/


Edwin Tam[_4_]

how to know the column/row of a selected cell in vba?
 
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


--
Message posted from http://www.ExcelForum.com



Chris

how to know the column/row of a selected cell in vba?
 
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?

JE McGimpsey wrote in message ...
One way:

x_col = ActiveCell.Column
x_row = ActiveCell.Row

In article ,
daryl wrote:

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

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

thank you for the help


---
Message posted from http://www.ExcelForum.com/


JE McGimpsey

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

Range("G11").Activate

another:

ActiveCell.Offset(1, 0). Activate

A third:

ActiveCell(2, 1).Activate

In article ,
(Chris) wrote:

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?



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

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