PDA

View Full Version : [SOLVED:] Need an advice for Insert new Row in other Sheet in VBA



rong3
09-29-2017, 01:50 AM
HI everyone, i have 2 sheets that A and B.
I got stuck on insert new row by code as below in other sheet in the same workbook.


Rows(i).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

So it works on A (which active sheet), but what i need is insert new row in B in case the active sheet is A.

I tried to code like "Sheet(B).Select " or "With Sheets(B)" or samething like that, but fails.
Can anyone help me this? Hope the help come soon!!! Thanks in advance!!!:banghead:

Aussiebear
09-29-2017, 02:20 AM
Try the following instead

Worksheets(Sheet B).Activate

rong3
09-29-2017, 02:33 AM
Thank you, I solved by

Sheets(B).Rows(i).Insert Shift:=xlDown