General discussion

Locked

Go to Active Cell in a Macro?

By BHOLT ·
In a Excel macro, how do you make the macro start an action (such as inserting a row) at the "active cell" rather than at a specific cell such as "C4"? When using the "Record Macro" it keeps entering the specific cell.

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Go to Active Cell in a Macro?

by DKlippert In reply to Go to Active Cell in a Ma ...

When you record the macro, you can click the Relative Address button just to the right of the Stop button on the Record macro toolbar. This will toggle between Absolute and Relative addressing.

Sub AddaRow
Selection.EntireRow.Insert
End Sub

Collapse -

Go to Active Cell in a Macro?

by Shanghai Sam In reply to Go to Active Cell in a Ma ...

I believe what I'm needing has to do with the R1C1 style of addresses. I tried typing the F4 key which is what I use for the absolute address but it didn't the way the macro recorded. I also changed to the R1C1 style but it didn't change the way the macro recorded either.

Collapse -

Go to Active Cell in a Macro?

by DKlippert In reply to Go to Active Cell in a Ma ...

When you are recording a macro, you dont use the F4 key. Start the macro recorder. This from the Help file:

"If you want the macro to run relative to the position of the active cell, record it using relative cell references button. On the Stop Recording toolbar, click Relative Reference (just to the right of the Stop button) so that it is selected. Excel will continue to record macros with relative references until you quit Excel or until you click Relative Reference again, so that it is not selected."

Collapse -

Go to Active Cell in a Macro?

by BHOLT In reply to Go to Active Cell in a Ma ...

THANK YOU FOR YOUR HELP AND YOUR PATIENCE

Collapse -

Go to Active Cell in a Macro?

by BHOLT In reply to Go to Active Cell in a Ma ...

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums