Since I don't know how many sheets are in your workbook, I chose an approach 
that works quickly with a large number of sheets.
In the following macro, I defined a Dictionary Object and stored the names of 
the sheets currently selected.
Then, I find the first sheet that is NOT in the list and select it (which 
effectively "de-selects" the original sheets)I then loop through the sheets 
collection and select all sheets not in the original selection.
Since my sample file had hidden sheets, I also tested to see if the sheet is 
visible before attempting to select it.
Option ExplicitSub Reverse_Sheet_Selection()    Dim sht, Dict_Sheets    
Application.ScreenUpdating = False    
'------------------------------------------------------    Set Dict_Sheets = 
CreateObject("Scripting.Dictionary")        Dict_Sheets.RemoveAll    
'------------------------------------------------------    For Each sht In 
ActiveWorkbook.Windows(1).SelectedSheets        If (Not 
Dict_Sheets.exists(sht.Name)) Then                Dict_Sheets.Add sht.Name, 
"selected"        End If    Next sht    
'--------------------------------------------    ' Select First Sheet    
'--------------------------------------------    For Each sht In Sheets        
If (Not Dict_Sheets.exists(sht.Name)) Then            If (sht.Visible) Then     
           sht.Select                Exit For            End If        End If   
 Next sht    '--------------------------------------------    ' Select other 
sheets    '--------------------------------------------    For Each sht In 
Sheets        If (Not Dict_Sheets.exists(sht.Name)) Then            If 
(sht.Visible) Then                sht.Select (False)            End If        
End If    Next sht    Application.ScreenUpdating = TrueEnd Sub 
Paul-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------
 
      From: Nilkanth Raval <nilkanth.ra...@gmail.com>
 To: excel-macros@googlegroups.com 
 Sent: Tuesday, June 16, 2015 5:07 PM
 Subject: Re: $$Excel-Macros$$ Inverse Selection of Worksheets.
   
Dear Sir,
Or select specific sheets, then use a macro to reverse the selection?

Please help me.
Thanks,Nilkanth Raval+91 900 428 0 428+91 808 000 1620Think Before You 
Print.Consider ENVIRONMENT.“SAVE TREES, SAVE EARTH”  
“All appears to change when we change!”



On 17 June 2015 at 01:51, Paul Schreiner <schreiner_p...@att.net> wrote:

Could you please explain?
Are you saying you want to select all sheets EXCEPT specific sheets?
Or select specific sheets, then use a macro to reverse the selection? 
Paul-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------
 
      From: Nilkanth Raval <nilkanth.ra...@gmail.com>
 To: excel-macros@googlegroups.com 
 Sent: Tuesday, June 16, 2015 3:52 PM
 Subject: $$Excel-Macros$$ Inverse Selection of Worksheets.
   
Hi Friends,
How to do Inverse Selection of Worksheets.
Please help me.
Thanks,Nilkanth Raval+91 900 428 0 428+91 808 000 1620Think Before You 
Print.Consider ENVIRONMENT.“SAVE TREES, SAVE EARTH”  
“All appears to change when we change!”
-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


   
 -- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


   

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to