Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default AutoFilter VBA Problem

I have a macro that I think should hide the AutoFilter arrow in column E
only. It runs as follows:

Sub HideArrows()
Dim c As Range
Dim i As Integer
i = Cells(1, 1).End(xlToRight).Column
Application.ScreenUpdating = False

For Each c In Range(Cells(1, 1), Cells(1, i))
If c.Column = 5 Then
c.AutoFilter Field:=c.Column, _
Visibledropdown:=False
End If
Next

Application.ScreenUpdating = True
End Sub

When I run it, however, I keep getting a compile error, indicating that only
comments may appear after end sub, etc., and it highlights the very first
liine of the program. There are no other macros before this.

Help! I know virtually nothing about VBA, so probably I've made a very basic
error. Where did I go wrong?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default AutoFilter VBA Problem

You've got some kind of invisible characters in your code window.

Try highlighting the stuff to the right of "end sub" and all the way down.

Then hit the delete key.

Michael Link wrote:

I have a macro that I think should hide the AutoFilter arrow in column E
only. It runs as follows:

Sub HideArrows()
Dim c As Range
Dim i As Integer
i = Cells(1, 1).End(xlToRight).Column
Application.ScreenUpdating = False

For Each c In Range(Cells(1, 1), Cells(1, i))
If c.Column = 5 Then
c.AutoFilter Field:=c.Column, _
Visibledropdown:=False
End If
Next

Application.ScreenUpdating = True
End Sub

When I run it, however, I keep getting a compile error, indicating that only
comments may appear after end sub, etc., and it highlights the very first
liine of the program. There are no other macros before this.

Help! I know virtually nothing about VBA, so probably I've made a very basic
error. Where did I go wrong?


--

Dave Peterson
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
autofilter problem Karmen New Users to Excel 0 February 15th 06 01:43 PM
Custom autofilter Bug In excel 2002 Matthew D Excel Discussion (Misc queries) 0 February 14th 06 02:54 AM
Excel AutoFilter Problem Shereene Excel Discussion (Misc queries) 8 July 6th 05 10:37 PM
Autofilter problem Jake Excel Worksheet Functions 1 July 5th 05 12:12 PM
Freeze Pane problem in shared workbooks JM Excel Discussion (Misc queries) 1 February 1st 05 12:04 AM


All times are GMT +1. The time now is 11:02 AM.

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"