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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
64,579
Office Version
  1. 365
Platform
  1. Windows
Is that a zero or on "O"?

Columns("BO:IV").Select
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
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
 

Forum statistics

Threads
1,170,932
Messages
5,872,779
Members
432,945
Latest member
eddyevad

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
Top