PC Review


Reply
Thread Tools Rate Thread

Deselect cells on multiple sheets after unhide

 
 
Sherry
Guest
Posts: n/a
 
      24th Feb 2010
I have the following code I use to remove the autofilters and hidden rows and
columns within a workbook. It works great. My problem is that after it runs,
the columns that were unhidden remain selected. I have more code later in the
process that won't run because there are cells selected.

Is there an easy snippet of code so that I can select cell "A2" on every
sheet in a workbook at once? I've tried a couple on my own but no luck.
Thanks!
--
Thanks,
Sherry
 
Reply With Quote
 
 
 
 
Sherry
Guest
Posts: n/a
 
      24th Feb 2010
Oops...forgot the code. Sorry.

Sub RemoveFiltersAndHiddenRows()

Dim oWS As Worksheet

For Each oWS In ActiveWorkbook.Sheets

oWS.AutoFilterMode = False
oWS.UsedRange.Rows.Hidden = False
oWS.UsedRange.Columns.Hidden = False
Next

End Sub

--
Thanks,
Sherry


"Sherry" wrote:

> I have the following code I use to remove the autofilters and hidden rows and
> columns within a workbook. It works great. My problem is that after it runs,
> the columns that were unhidden remain selected. I have more code later in the
> process that won't run because there are cells selected.
>
> Is there an easy snippet of code so that I can select cell "A2" on every
> sheet in a workbook at once? I've tried a couple on my own but no luck.
> Thanks!
> --
> Thanks,
> Sherry

 
Reply With Quote
 
john
Guest
Posts: n/a
 
      24th Feb 2010
Sherry,
see if this does what you want. Be mindful though that your code will error
if any of the sheets are protected.

Sub RemoveFiltersAndHiddenRows()

Dim oWS As Worksheet

With Application

.EnableEvents = False
.ScreenUpdating = False

End With


For Each oWS In ActiveWorkbook.Sheets

With oWS

.Activate

.AutoFilterMode = False

With .UsedRange

.Rows.Hidden = False
.Columns.Hidden = False

End With

.Range("A2").Select

End With

Next

With Application

.EnableEvents = True
.ScreenUpdating = True

End With

End Sub

--
jb


"Sherry" wrote:

> Oops...forgot the code. Sorry.
>
> Sub RemoveFiltersAndHiddenRows()
>
> Dim oWS As Worksheet
>
> For Each oWS In ActiveWorkbook.Sheets
>
> oWS.AutoFilterMode = False
> oWS.UsedRange.Rows.Hidden = False
> oWS.UsedRange.Columns.Hidden = False
> Next
>
> End Sub
>
> --
> Thanks,
> Sherry
>
>
> "Sherry" wrote:
>
> > I have the following code I use to remove the autofilters and hidden rows and
> > columns within a workbook. It works great. My problem is that after it runs,
> > the columns that were unhidden remain selected. I have more code later in the
> > process that won't run because there are cells selected.
> >
> > Is there an easy snippet of code so that I can select cell "A2" on every
> > sheet in a workbook at once? I've tried a couple on my own but no luck.
> > Thanks!
> > --
> > Thanks,
> > Sherry

 
Reply With Quote
 
Sherry
Guest
Posts: n/a
 
      24th Feb 2010
Works great! Thanks, John!
--
Thanks,
Sherry


"john" wrote:

> Sherry,
> see if this does what you want. Be mindful though that your code will error
> if any of the sheets are protected.
>
> Sub RemoveFiltersAndHiddenRows()
>
> Dim oWS As Worksheet
>
> With Application
>
> .EnableEvents = False
> .ScreenUpdating = False
>
> End With
>
>
> For Each oWS In ActiveWorkbook.Sheets
>
> With oWS
>
> .Activate
>
> .AutoFilterMode = False
>
> With .UsedRange
>
> .Rows.Hidden = False
> .Columns.Hidden = False
>
> End With
>
> .Range("A2").Select
>
> End With
>
> Next
>
> With Application
>
> .EnableEvents = True
> .ScreenUpdating = True
>
> End With
>
> End Sub
>
> --
> jb
>
>
> "Sherry" wrote:
>
> > Oops...forgot the code. Sorry.
> >
> > Sub RemoveFiltersAndHiddenRows()
> >
> > Dim oWS As Worksheet
> >
> > For Each oWS In ActiveWorkbook.Sheets
> >
> > oWS.AutoFilterMode = False
> > oWS.UsedRange.Rows.Hidden = False
> > oWS.UsedRange.Columns.Hidden = False
> > Next
> >
> > End Sub
> >
> > --
> > Thanks,
> > Sherry
> >
> >
> > "Sherry" wrote:
> >
> > > I have the following code I use to remove the autofilters and hidden rows and
> > > columns within a workbook. It works great. My problem is that after it runs,
> > > the columns that were unhidden remain selected. I have more code later in the
> > > process that won't run because there are cells selected.
> > >
> > > Is there an easy snippet of code so that I can select cell "A2" on every
> > > sheet in a workbook at once? I've tried a couple on my own but no luck.
> > > Thanks!
> > > --
> > > Thanks,
> > > Sherry

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Unhide Multiple Sheets Bev Microsoft Excel Misc 1 9th Jun 2009 04:01 PM
Unhide Multiple Sheets Bev Microsoft Excel Misc 2 9th Jun 2009 03:45 PM
Unhide multiple sheets albertmb Microsoft Excel Misc 3 24th Nov 2008 05:03 PM
Unhide Multiple Sheets at once stef Microsoft Excel Discussion 8 25th Jun 2007 05:43 AM
unhide multiple sheets txbjones Microsoft Excel Discussion 1 17th Nov 2003 06:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:37 PM.