Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Exclude hidden sheets from formatting

I'm using this sub which operates the way it should except it formats
one sheet hidden I would like left alone, I tried fixing it using the
below listed code, but I can't get it to work.

Public Sub Fix_Up_Sheets()
Dim SH As Worksheet
For Each SH In Worksheets
With SH
.Rows().RowHeight = 78
.Rows(1).RowHeight = 15
.Columns("C").Insert
With .Range("A1:S1")
.Font.Bold = True
.Font.Color = vbRed
.Cells.Interior.Color = vbYellow
.Columns("c").ColumnWidth = 18
.Columns("b").ColumnWidth = 15.29
.Columns("e").ColumnWidth = 15.29
End With
End With
Next
End Sub
' this will exclude all hidden worksheets
Private Sub Test()
For Each ws in Worksheets
If Not ws.Visible = False Then
ws.Activate
[actions]
End If
Next ws
End Sub

Could someone please combine the two, thanks

Bart
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Exclude hidden sheets from formatting

Try this

Public Sub Fix_Up_Sheets()
Dim SH As Worksheet
For Each SH In Worksheets
If SH.Visible = True Then 'exclude none visible
With SH
.Rows().RowHeight = 78
.Rows(1).RowHeight = 15
.Columns("C").Insert
With .Range("A1:S1")
.Font.Bold = True
.Font.Color = vbRed
.Cells.Interior.Color = vbYellow
.Columns("c").ColumnWidth = 18
.Columns("b").ColumnWidth = 15.29
.Columns("e").ColumnWidth = 15.29
End With
End With
End If
Next
End Sub

Mike

"Bart" wrote:

I'm using this sub which operates the way it should except it formats
one sheet hidden I would like left alone, I tried fixing it using the
below listed code, but I can't get it to work.

Public Sub Fix_Up_Sheets()
Dim SH As Worksheet
For Each SH In Worksheets
With SH
.Rows().RowHeight = 78
.Rows(1).RowHeight = 15
.Columns("C").Insert
With .Range("A1:S1")
.Font.Bold = True
.Font.Color = vbRed
.Cells.Interior.Color = vbYellow
.Columns("c").ColumnWidth = 18
.Columns("b").ColumnWidth = 15.29
.Columns("e").ColumnWidth = 15.29
End With
End With
Next
End Sub
' this will exclude all hidden worksheets
Private Sub Test()
For Each ws in Worksheets
If Not ws.Visible = False Then
ws.Activate
[actions]
End If
Next ws
End Sub

Could someone please combine the two, thanks

Bart

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Exclude hidden sheets from formatting

On Sep 29, 11:25*am, Mike H wrote:
Try this

Public Sub Fix_Up_Sheets()
* Dim SH As Worksheet
* For Each SH In Worksheets
* If SH.Visible = True Then 'exclude none visible
* * With SH
* * * .Rows().RowHeight = 78
* * * .Rows(1).RowHeight = 15
* * * .Columns("C").Insert
* * * With .Range("A1:S1")
* * * * .Font.Bold = True
* * * * .Font.Color = vbRed
* * * * .Cells.Interior.Color = vbYellow
* * * * .Columns("c").ColumnWidth = 18
* * * * .Columns("b").ColumnWidth = 15.29
* * * * .Columns("e").ColumnWidth = 15.29
* * * End With
* * End With
End If
* Next
End Sub

Mike

"Bart" wrote:
I'm using this sub which operates the way it should except it formats
one sheet hidden I would like left alone, I tried fixing it using the
below listed code, but I can't get it to work.


Public Sub Fix_Up_Sheets()
* Dim SH As Worksheet
* For Each SH In Worksheets
* * With SH
* * * .Rows().RowHeight = 78
* * * .Rows(1).RowHeight = 15
* * * .Columns("C").Insert
* * * With .Range("A1:S1")
* * * * .Font.Bold = True
* * * * .Font.Color = vbRed
* * * * .Cells.Interior.Color = vbYellow
* * * * .Columns("c").ColumnWidth = 18
* * * * .Columns("b").ColumnWidth = 15.29
* * * * .Columns("e").ColumnWidth = 15.29
* * * End With
* * End With
* Next
End Sub
' this will exclude all hidden worksheets
Private Sub Test()
* *For Each ws in Worksheets
* * * If Not ws.Visible = False Then
* * * * *ws.Activate
* * * * *[actions]
* * * End If
* *Next ws
End Sub


Could someone please combine the two, thanks


Bart


Thanks Mike that works great.

Bart
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
Exclude Hidden Row Values Dewayne Excel Worksheet Functions 4 January 1st 10 05:22 PM
Copy Worksheet and Exclude Hidden fields Charles Gonzalez Excel Worksheet Functions 3 August 12th 08 12:31 AM
Exclude data from summary totals when hidden XVOTE Excel Worksheet Functions 1 April 13th 06 03:37 PM
Exclude hidden workbooks from list Duke Carey Excel Programming 3 December 22nd 05 02:40 PM
Exclude hidden data from summary totals XVOTE Excel Discussion (Misc queries) 2 June 3rd 05 05:26 AM


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