syntax error for counting the number of columns end.

G

Guest

I had a macro to hide some columns on the end of a report. They keep
changing the columns on the right so I changed it to automatically count to
the last column and now I get a syntax error. THANKS!

Public Sub HideXtraColumns()
Dim Rng As Range
' HideCells Macro

With ActiveSheet
'Columns("O:Z").EntireColumn.Hidden = False

Columns(15:(Columns.Count, 1).End(xltoRight)).EntireColumn.Hidden = True
End With
End Sub
 
T

Tom Ogilvy

With Activesheet
.Range(.Cells(1,15), .Cells(1,.Columns.count) _
.End(xltoLeft)).EntireColumn.Hidden = True
End With
 

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