ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   skip empty sheets (https://www.excelbanter.com/excel-programming/322485-skip-empty-sheets.html)

Rob

skip empty sheets
 
I am using a script downloaded from a web page the code
below is missing out my charts from the list of results
due to the skip empty sheets part. Please can someone
tell me how to take it out so the charts are part of the
list!

Thanks

' Add the checkboxes
TopPos = 40
For i = 1 To ActiveWorkbook.Worksheets.Count
Set CurrentSheet = ActiveWorkbook.Worksheets(i)
' Skip empty sheets and hidden sheets
If Application.CountA(CurrentSheet.Cells) < 0
And _
CurrentSheet.Visible Then
SheetCount = SheetCount + 1
PrintDlg.CheckBoxes.Add 78, TopPos, 150, 16.5
PrintDlg.CheckBoxes(SheetCount).Text = _
CurrentSheet.Name
TopPos = TopPos + 13
End If
Next i

' Move the OK and Cancel buttons
PrintDlg.Buttons.Left = 240

gocush[_29_]

skip empty sheets
 
Can you restate or explain what you mean by:

"the code below is missing out my charts from the list of results
due to the skip empty sheets part."

"Rob" wrote:

I am using a script downloaded from a web page the code
below is missing out my charts from the list of results
due to the skip empty sheets part. Please can someone
tell me how to take it out so the charts are part of the
list!

Thanks

' Add the checkboxes
TopPos = 40
For i = 1 To ActiveWorkbook.Worksheets.Count
Set CurrentSheet = ActiveWorkbook.Worksheets(i)
' Skip empty sheets and hidden sheets
If Application.CountA(CurrentSheet.Cells) < 0
And _
CurrentSheet.Visible Then
SheetCount = SheetCount + 1
PrintDlg.CheckBoxes.Add 78, TopPos, 150, 16.5
PrintDlg.CheckBoxes(SheetCount).Text = _
CurrentSheet.Name
TopPos = TopPos + 13
End If
Next i

' Move the OK and Cancel buttons
PrintDlg.Buttons.Left = 240


Mike Fogleman

skip empty sheets
 
I believe he means that if his sheet contains only charts, then the line:

If Application.CountA(CurrentSheet.Cells) < 0
considers it to be "empty" and does not make a checkbox for that sheet. I
would think he should add another test for Objects.Count <0

If Application.CountA(CurrentSheet.Cells) < 0 _
And CurrentSheet.Objects.count <0 _
And CurrentSheet.Visible Then
.... 'make checkboxes
End If

Mike F

"gocush" /delete wrote in message
...
Can you restate or explain what you mean by:

"the code below is missing out my charts from the list of results
due to the skip empty sheets part."

"Rob" wrote:

I am using a script downloaded from a web page the code
below is missing out my charts from the list of results
due to the skip empty sheets part. Please can someone
tell me how to take it out so the charts are part of the
list!

Thanks

' Add the checkboxes
TopPos = 40
For i = 1 To ActiveWorkbook.Worksheets.Count
Set CurrentSheet = ActiveWorkbook.Worksheets(i)
' Skip empty sheets and hidden sheets
If Application.CountA(CurrentSheet.Cells) < 0
And _
CurrentSheet.Visible Then
SheetCount = SheetCount + 1
PrintDlg.CheckBoxes.Add 78, TopPos, 150, 16.5
PrintDlg.CheckBoxes(SheetCount).Text = _
CurrentSheet.Name
TopPos = TopPos + 13
End If
Next i

' Move the OK and Cancel buttons
PrintDlg.Buttons.Left = 240





All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com