I
inarobis
Hello,
Someone can help me on this error to 0
So I have a little sub that copy several times the same sheet (Sheet 2
--> Template) according to the number of name in the rngRange (range)
in sheet1
For example, if I have three names in range rngRange (Report1,
Report2, and Report3) then it will copy three times the sheet2 and I
will rename it accordingly report1, report2 and report3
I am getting Err 0 problem, I could resolve on putting On Error GoTo 0
in the end of the sub. Someone can help me on understanding this
issue
?
Ina
'---------------------------------------------------------------------------------------------
Public Sub CreateReportRange()
On Error GoTo CreateReportRange_Err
Dim strSheetName As String
Dim rngCell As Range
If ActiveWorkbook Is Nothing Then Exit Sub
Sheets("Sheet1").Select
For Each rngCell In Range("rngRange").Cells
strSheetName = rngCell
Sheets("Sheet2").Copy After:=Sheets("Sheet2")
ActiveSheet.name = strSheetName
Next rngCell
CreateReportRange_Err:
MsgBox "CreateReportRange_Err " & Err.Description & " " & Err.Number
End Sub
'---------------------------------------------------------------------------------------------------------------
Someone can help me on this error to 0
So I have a little sub that copy several times the same sheet (Sheet 2
--> Template) according to the number of name in the rngRange (range)
in sheet1
For example, if I have three names in range rngRange (Report1,
Report2, and Report3) then it will copy three times the sheet2 and I
will rename it accordingly report1, report2 and report3
I am getting Err 0 problem, I could resolve on putting On Error GoTo 0
in the end of the sub. Someone can help me on understanding this
issue

Ina
'---------------------------------------------------------------------------------------------
Public Sub CreateReportRange()
On Error GoTo CreateReportRange_Err
Dim strSheetName As String
Dim rngCell As Range
If ActiveWorkbook Is Nothing Then Exit Sub
Sheets("Sheet1").Select
For Each rngCell In Range("rngRange").Cells
strSheetName = rngCell
Sheets("Sheet2").Copy After:=Sheets("Sheet2")
ActiveSheet.name = strSheetName
Next rngCell
CreateReportRange_Err:
MsgBox "CreateReportRange_Err " & Err.Description & " " & Err.Number
End Sub
'---------------------------------------------------------------------------------------------------------------