Error 1004

Cberry

Board Regular
Joined
Jul 14, 2006
Messages
95
Why is this:
Code:
Columns("BO:IV").Select
    Selection.EntireColumn.Hidden = True

Giving me a 1004 error.

Here is the entire macro:

Code:
ActiveSheet.Unprotect
    Range("A1").Select
    Sheets("Calculation").Select
    ActiveSheet.Unprotect
    Range("BN3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Range("BM3").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Range("A2").Select
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    Sheets("Calculation").Select
    Range("E3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.ClearContents
    Range("I3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents
    Columns("BO:IV").Select
    Selection.EntireColumn.Hidden = True
    Range("A1").Select
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Is that a zero or on "O"?

Columns("BO:IV").Select
 
Upvote 0
Hi,

and what's the error message ?
you get error 1004 when the sheet is protected "property hidden ..."

but then some lines before there should be a bug too
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
....
Selection.ClearContents

kind regards,
Erik
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

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