VB macro script to find column A in Excel when row not known

P

Pete

In writing a VB macro for an Excel workbook, I want the user to be able to
insert a row in the active sheet by clicking a (command) button, and then
have the macro continue to do some copying, etc. Because the active cell's
row is unknown, how do I get the macro to make column 1 of the active row
(cell A?) the active cell?. Certain other macro actions will be dependant on
this.
All help appreciated!
 
J

Jacob Skaria

You dont need to activate or select a cell to write data in.

You can refer the cell as
Range("A" & activecell.Row) = "something"
OR
Cells(ActiveCell.Row,1) = "something"

To insert a row at the active cell
Rows(activecell.Row).insert

To activate...
Range("A" & activecell.Row).Activate



If this post helps click Yes
 
O

OssieMac

Hi Pete,

I am not sure if I am interpreting your question correctly. Do you mean that
if a cell is selected anywhere on the worksheet, you want to select the cell
in column A with the same row number? If so, the the following code should do
what you want.

Cells(ActiveCell.Row, "A").Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top