ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Cell row-column numbers to variable (https://www.excelbanter.com/excel-programming/272964-vba-cell-row-column-numbers-variable.html)

Joe[_19_]

VBA Cell row-column numbers to variable
 
In VBA, I need code that will let met set a variable equal
to the current cell in the Excel spreadsheet's row number
and set a second variable equal to the current cells
column number. i.e. if cell B3 is picked in the
spreadsheet and I run the macro I want the VBA code to set
variable R1 = 3 and set variable C1 = 2 since cell B3 is
picked. Your help is appreciated.

steve

VBA Cell row-column numbers to variable
 
Joe,

Don't recommend using R1 & C1 since they could represent cell addresses.

crow = Activecell.Row
ccol = Activecell.Column

steve

"Joe" wrote in message
...
In VBA, I need code that will let met set a variable equal
to the current cell in the Excel spreadsheet's row number
and set a second variable equal to the current cells
column number. i.e. if cell B3 is picked in the
spreadsheet and I run the macro I want the VBA code to set
variable R1 = 3 and set variable C1 = 2 since cell B3 is
picked. Your help is appreciated.





All times are GMT +1. The time now is 05:12 PM.

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