Ok so I lied before, I have one more item I need some assistance with. Everything is working properly, but on the index page that I have each index item has a checkbox (about 30 boxes in total) that determines the visibility of the corresponding sheet. If the box is checked, the sheet is visible; if not, then its not visible. Each checkbox is also set to run the index renumbering macro/application as well as the sequential sheet renumbering macro/application. Then there is also a bottom checkbox that is a select/deselect all option for the index.
The problem I am having is that since each checkbox is doing multiple tasks, it is taking quite a bit of time to complete. And when I use the select/deselect all check box it can take upwards of 30 seconds or more to finish all the operations.
Its not a huge deal, but if there is a way to simplify the code to help it run a little faster it would be much better.
Here are the codes :
Checkbox code (one for each of the 30 or so check boxes):
Sheet renumbering code:
Index Renumbering Code:
Any ideas?
And again, thanks to everyone who has helped provide me the above codes to get this project finished... you have all been awesome!!
The problem I am having is that since each checkbox is doing multiple tasks, it is taking quite a bit of time to complete. And when I use the select/deselect all check box it can take upwards of 30 seconds or more to finish all the operations.
Its not a huge deal, but if there is a way to simplify the code to help it run a little faster it would be much better.
Here are the codes :
Checkbox code (one for each of the 30 or so check boxes):
Code:
Private Sub CheckBox1_Click()
Sheets("1st Stg Impeller").Visible = CheckBox1.Value
Application.Run "IndexNumber"
Application.Run "SequentiallyNumberVisiblePagesOnly"
End Sub
Sheet renumbering code:
Code:
Sub SequentiallyNumberVisiblePagesOnly()
Dim lx As Long
Dim lVisibleSheets As Long
'Dim lVisibleCount As Long
' For lx = 1 To Worksheets.Count
'If Worksheets(lx).Visible = True Then lVisibleSheets = lVisibleSheets + 1
' Next
For lx = 1 To Worksheets.Count
If Worksheets(lx).Visible = True Then lVisibleCount = lVisibleCount + 1
With Worksheets(lx).PageSetup
.RightFooter = lVisibleCount
End With
Next
End Sub
Index Renumbering Code:
Code:
Sub IndexNumber()
Dim lx As Long
Dim sIndex As String
Dim sIndexStartRange As String
Dim lVisibleCount As Long
sIndex = "Index"
sIndexStartRange = "A7"
Worksheets(sIndex).Range("A7:A60").Cells.ClearContents
With Worksheets(sIndex).Range("A7")
For lx = 1 To Worksheets.Count
Select Case Worksheets(lx).Name
'uncomment next line to skip Index line
'Case sIndex
'do nothing
Case Else
If Worksheets(lx).Visible = True Then
lVisibleCount = lVisibleCount + 1
'uncomment next 2 lines to show only visible sheets/number in index
'.Offset(lVisibleCount, 0) = lVisibleCount
'.Offset(lVisibleCount, 1) = Worksheets(lX).Name
End If
'uncomment next 2 lines show all sheet names, only visible numbers
If Worksheets(lx).Visible = True Then .Offset(lx - 1, 0) = lVisibleCount
'.Offset(lx - 1, 1) = Worksheets(lx).Name '<-- prints sheet name
End Select
Next
End With
End Sub
Any ideas?
And again, thanks to everyone who has helped provide me the above codes to get this project finished... you have all been awesome!!