Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default syntax error for counting the number of columns end.

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default syntax error for counting the number of columns end.

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

--
Regards,
Tom Ogilvy


"Janis" wrote in message
...
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Counting 10 Columns * X Number of Rows Rob Excel Worksheet Functions 5 April 7th 09 09:22 PM
Counting the number of Error Types Bob Excel Worksheet Functions 3 November 16th 06 06:01 PM
runtime error: syntax error or access violation oucsester[_2_] Excel Programming 1 May 3rd 06 05:51 PM
runtime error: syntax error or access violation oucsester Excel Programming 0 May 3rd 06 02:22 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


All times are GMT +1. The time now is 08:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"