Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Deselect cells on multiple sheets after unhide

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Deselect cells on multiple sheets after unhide

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Deselect cells on multiple sheets after unhide

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Deselect cells on multiple sheets after unhide

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
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
Unhide multiple sheets albertmb Excel Discussion (Misc queries) 3 November 24th 08 05:03 PM
Unhide multiple sheets all at once glenlee Excel Discussion (Misc queries) 3 August 11th 07 06:42 AM
How to unhide multiple sheets in one go Grd Excel Programming 2 March 9th 06 01:55 AM
Can I unhide multiple sheets at once? Brockli Excel Discussion (Misc queries) 1 February 24th 05 07:46 PM
How do I unhide multiple sheets? ahonig Excel Worksheet Functions 3 December 14th 04 09:03 PM


All times are GMT +1. The time now is 03:54 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"