Problem inserting rows (and cutting)

J

jodleren

Hello

I got a macro to fix, which has worked.

The original code was:

Columns("M:M").Select
Selection.Cut
Range("L1").Select ' was L1
Selection.Insert Shift:=xlToRight

I tried this also:
Range("L1").Select
DoEvents
Range("L1").Insert

and both gives the error:

Runtime error 1004
Insert method of Range class failed.

What can cause this?

WBR
Sonnich
 
J

jodleren

Hello

I got a macro to fix, which has worked.

The original code was:

    Columns("M:M").Select
    Selection.Cut
    Range("L1").Select ' was L1
    Selection.Insert Shift:=xlToRight

I tried this also:
    Range("L1").Select
    DoEvents
    Range("L1").Insert

and both gives the error:

Runtime error 1004
Insert method of Range class failed.

What can cause this?

WBR
Sonnich

Adding this does not help

For aa = 1 To ActiveWorkbook.Worksheets.Count
ActiveWorkbook.Worksheets(aa).Unprotect
Next
 
J

jodleren

Adding this does not help

    For aa = 1 To ActiveWorkbook.Worksheets.Count
      ActiveWorkbook.Worksheets(aa).Unprotect
    Next

I made this up:

Range("L1").Select
Columns("L:L").Insert
Columns("N:N").Select
Selection.Cut
ActiveSheet.Paste Destination:=ActiveSheet.Range("L:L")

This works.

Any better ideas?

Sonnich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top