Visual Basic Help in Excel

3 replies
Found 23rd Nov 2009
Hi,

I am trying to set up some code for a macro in Excel, but it keeps rejecting the third line (Range("A3").Select). see script below. can anyone help as this all seems correct to me but excel doesn't seem to agree!!!

Thanks!

Application.ScreenUpdating = False
Sheets("Database").Select
Range("A3").Select
Rows("3:3").Select
Selection.Insert Shift:=xlDown
Range("A3").Select
Selection.EntireRow.Insert

  1. Misc
  2. Asics
Groups
  1. Misc
  2. Asics
3 Comments

This has happened to me before but only occasionally what I have tried in the past is change
Range("A3").Select > Sheets("Database").Range("A3").Select

What exactly do you want that code to do, it runs for me but not too sure what are looking to achieve.

Those few lines simply insert 2 rows at row 3.

I would use this code...

Sheets("Database").Select
[3:5].Insert

Not sure why your original code caused an error. Maybe the worksheet or workbook were protected?
Post a comment
Avatar
@
    Text
    Top Discussions
    1. Highway code and use of indicators (or lack thereof)4178
    2. Add one, leave one game54415459
    3. Without giving away your age, name three things that remind you of when you…51113
    4. saying of the day89412

    See more discussions