Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have an ActiveCell, I want to add a row to where that active cell is 1

Status
Not open for further replies.

coolcarls

Technical User
Jan 19, 2002
182
US
If the active cell is in A4, I would like a macro to add a complet row to row4. If next time the active cell is P451 then I need a whole row added to Row451.
Any ideas??
Thanks in advance
Carl
 
Rows(CStr(ActiveCell.Row) & ":" & CStr(ActiveCell.Row)).Insert Shift:=xlDown
 
Wow this place is great.
Thanks, that worked!!
 
I'm fairly new and just curious....

Why not just
ActiveCell.EntireRow.Insert

What's the cStr and stuff?
 
Pcfred
There is no reason why you couldn't just use
ActiveCell.EntireRow.Insert

Also no reason why you couldn't use any of these
Rows(ActiveCell.Row & ":" & ActiveCell.Row).Insert Shift:=xlDown
Rows(ActiveCell.Row).EntireRow.Insert
Rows(ActiveCell.Row).Insert

Note that the first one is the same as ETID's solution without the CStr. They will all work! CStr simply converts the value (of ActiveCell.Row) to a string. I don't believe it's needed but at the same time it isn't incorrect to include it.

;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top