ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA: How to specify 2nd cell of currently active row? (https://www.excelbanter.com/excel-programming/319528-vba-how-specify-2nd-cell-currently-active-row.html)

Rich

VBA: How to specify 2nd cell of currently active row?
 
In a macro, I want to be able to set the value of the second cell of the
currently active row. How can I calculate the correct range or offset to do
this? For example, if the currently active cell is An, I want to set A2 to a
specific value.

Thanks,

Rich

Ron de Bruin

How to specify 2nd cell of currently active row?
 
Hi Rich

For a row
Cells(ActiveCell.Row, 2).Value = 100

For a column
Cells(2, ActiveCell.Column).Value = 100


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Rich" wrote in message ...
In a macro, I want to be able to set the value of the second cell of the
currently active row. How can I calculate the correct range or offset to do
this? For example, if the currently active cell is An, I want to set A2 to a
specific value.

Thanks,

Rich




Rich

How to specify 2nd cell of currently active row?
 
Thanks!

Rich

"Ron de Bruin" wrote:

Hi Rich

For a row
Cells(ActiveCell.Row, 2).Value = 100

For a column
Cells(2, ActiveCell.Column).Value = 100


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Rich" wrote in message ...
In a macro, I want to be able to set the value of the second cell of the
currently active row. How can I calculate the correct range or offset to do
this? For example, if the currently active cell is An, I want to set A2 to a
specific value.

Thanks,

Rich






All times are GMT +1. The time now is 09:08 PM.

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