Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Grouped Sheets

Is there a way to check for and/or display an error message in VBA if the
active sheet is grouped with another sheet?

Thanks for your help.

--
Steph
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Grouped Sheets

Use this line of code to determine how many sheets are currently selected...

ActiveWindow.SelectedSheets.Count
--
HTH...

Jim Thomlinson


"Steph" wrote:

Is there a way to check for and/or display an error message in VBA if the
active sheet is grouped with another sheet?

Thanks for your help.

--
Steph

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Grouped Sheets

You can use this function to test whether any specific sheet is in a
group...

Function IsSheetGrouped(SheetName) As Boolean
On Error Resume Next
IsSheetGrouped = StrComp(ActiveWindow.SelectedSheets(SheetName). _
Name, SheetName, vbTextCompare) = 0
End Function

Using this function, you would do your test like this...

If IsSheetGrouped(ActiveSheet.Name) Then
' Yes, it is grouped
Else
' No, it is not grouped
End If

--
Rick (MVP - Excel)


"Steph" wrote in message
...
Is there a way to check for and/or display an error message in VBA if the
active sheet is grouped with another sheet?

Thanks for your help.

--
Steph


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Grouped Sheets

This slightly simpler coding appears to work as well as my previously posted
function...

Function IsSheetGrouped(SheetName As String) As Boolean
On Error Resume Next
IsSheetGrouped = ActiveWindow.SelectedSheets(SheetName).Index
End Function

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
You can use this function to test whether any specific sheet is in a
group...

Function IsSheetGrouped(SheetName) As Boolean
On Error Resume Next
IsSheetGrouped = StrComp(ActiveWindow.SelectedSheets(SheetName). _
Name, SheetName, vbTextCompare) = 0
End Function

Using this function, you would do your test like this...

If IsSheetGrouped(ActiveSheet.Name) Then
' Yes, it is grouped
Else
' No, it is not grouped
End If

--
Rick (MVP - Excel)


"Steph" wrote in message
...
Is there a way to check for and/or display an error message in VBA if the
active sheet is grouped with another sheet?

Thanks for your help.

--
Steph



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Grouped Sheets

Thank you - works great!

--
Steph


"Rick Rothstein" wrote:

This slightly simpler coding appears to work as well as my previously posted
function...

Function IsSheetGrouped(SheetName As String) As Boolean
On Error Resume Next
IsSheetGrouped = ActiveWindow.SelectedSheets(SheetName).Index
End Function

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
You can use this function to test whether any specific sheet is in a
group...

Function IsSheetGrouped(SheetName) As Boolean
On Error Resume Next
IsSheetGrouped = StrComp(ActiveWindow.SelectedSheets(SheetName). _
Name, SheetName, vbTextCompare) = 0
End Function

Using this function, you would do your test like this...

If IsSheetGrouped(ActiveSheet.Name) Then
' Yes, it is grouped
Else
' No, it is not grouped
End If

--
Rick (MVP - Excel)


"Steph" wrote in message
...
Is there a way to check for and/or display an error message in VBA if the
active sheet is grouped with another sheet?

Thanks for your help.

--
Steph




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
Paste into grouped sheets using VB kara stevenson Excel Worksheet Functions 2 January 19th 09 04:24 PM
Replace with Grouped Sheets Jim May Excel Discussion (Misc queries) 4 September 15th 06 02:19 PM
Grouped Sheets and Formating Pank Mehta Excel Discussion (Misc queries) 3 March 24th 05 01:42 AM
Printing Grouped Sheets Elaine Roden Excel Programming 4 May 31st 04 06:06 PM
Printing Grouped Sheets JMay Excel Programming 3 May 10th 04 11:26 PM


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