I have a problem that is going to drive me nuts. I am doing something just slightly wrong. I am trying to copy a worksheet so I can print it without a gray background to save toner, and for some reason I keep getting errors when I do this copy. Everything else works fine but the copy.
I have a button which does:
Private Sub CommandButton3_Click()
Dim Num As Integer
Dim i As Integer
Dim SecName As String
Call Printing.GetMaxRange(Num)
If (Num <> 1) Then
For i = 1 To Num
SecName = "SECTION_" & i
Call Printing.PrintMe(SecName)
Next i
Else
SecName = "SECTION_1"
Call Printing.PrintMe(SecName)
End If
end sub
Which calls the Sub()
Sub PrintMe(OldName As String)
Dim Valid As Boolean
Dim NewName As String
Sheets(OldName).Select
Sheets(OldName).Copy BEFORE:=Sheets("COVER_SHEET"
end sub
And the copy statement above is giving me lots of trouble. Sometimes it works, and sometimes it doesn't. Usually doesn't. The sheets I am working on are Section_1, Section_2, and so on through Section_i, where i is a maximum defined by how many sheets I created. And I used this same method to create all of these sheets that are now giving me problems.
All of the Section_i sheets are unhidden, and there is no protection on the workbook.
I have a button which does:
Private Sub CommandButton3_Click()
Dim Num As Integer
Dim i As Integer
Dim SecName As String
Call Printing.GetMaxRange(Num)
If (Num <> 1) Then
For i = 1 To Num
SecName = "SECTION_" & i
Call Printing.PrintMe(SecName)
Next i
Else
SecName = "SECTION_1"
Call Printing.PrintMe(SecName)
End If
end sub
Which calls the Sub()
Sub PrintMe(OldName As String)
Dim Valid As Boolean
Dim NewName As String
Sheets(OldName).Select
Sheets(OldName).Copy BEFORE:=Sheets("COVER_SHEET"
end sub
And the copy statement above is giving me lots of trouble. Sometimes it works, and sometimes it doesn't. Usually doesn't. The sheets I am working on are Section_1, Section_2, and so on through Section_i, where i is a maximum defined by how many sheets I created. And I used this same method to create all of these sheets that are now giving me problems.
All of the Section_i sheets are unhidden, and there is no protection on the workbook.