Strange result inserting row

Gregfox

Board Regular
Joined
Apr 12, 2011
Messages
120
Hi all I've worked 2 hours trying to determine the problem with the following simple code:
Code:
Sheet1.Rows(3).insert      'Insert a new row at Row3
When I run it on a blank workbook/worksheet it works just fine, however when I run it on a
workbook/worksheet with data it just passes (in single step) this code and does nothing. ??
Using 2007 on a PC non-protected workbook.

 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
It could be the way you're referencing the sheet, try specifying the name that is on the sheet tab

Sheets("Sheet1").Rows(3).insert
 
Upvote 0
Is there a Table on the sheet?
 
Upvote 0
Any other code in that workbook? Does any of the conditional formatting use a UDF?
 
Upvote 0
I gave up and will use what works:
Code:
    'Sheets("SUN").Select
    'Rows("3:3").Select
    'Selection.Insert Shift:=xlDown
    'Application.CutCopyMode = False
    'Selection.ClearContents

Many thanks for your efforts!
 
Upvote 0
If that works, are you sure that the code name for SUN is really Sheet1? What does Msgbox Sheet1.Name show?
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top