Hi,
I've created a sheet containing some macros (see below as an example).
The issue is that when I create a copy of this sheet in the same workbook, all the macros references get lost and i get the Run-time error '1004': The item with the specified name wasn't found.
Is there anyway to fix this issue?
Many thanks in advance,
Pablo
Sub OptionButton5_Click()
'
' OptionButton5_Click Macro
'
'
ActiveSheet.Shapes.Range(Array("TextBox 22")).Select
ActiveSheet.Shapes.Range(Array("TextBox 22", "TextBox 20")).Select
ActiveSheet.Shapes.Range(Array("TextBox 22", "TextBox 20", "TextBox 68")). _
Select
ActiveSheet.Shapes.Range(Array("TextBox 22", "TextBox 20", "TextBox 68", _
"TextBox 63")).Select
ActiveSheet.Shapes.Range(Array("TextBox 22", "TextBox 20", "TextBox 68", _
"TextBox 63", "TextBox 1")).Select
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0
.Solid
End With
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0
.Solid
End With
ActiveCell.Offset(2, -2).Range("A1:S3").Select
ActiveSheet.Shapes.Range(Array("Rectangle 2")).Select
End Sub
I've created a sheet containing some macros (see below as an example).
The issue is that when I create a copy of this sheet in the same workbook, all the macros references get lost and i get the Run-time error '1004': The item with the specified name wasn't found.
Is there anyway to fix this issue?
Many thanks in advance,
Pablo
Sub OptionButton5_Click()
'
' OptionButton5_Click Macro
'
'
ActiveSheet.Shapes.Range(Array("TextBox 22")).Select
ActiveSheet.Shapes.Range(Array("TextBox 22", "TextBox 20")).Select
ActiveSheet.Shapes.Range(Array("TextBox 22", "TextBox 20", "TextBox 68")). _
Select
ActiveSheet.Shapes.Range(Array("TextBox 22", "TextBox 20", "TextBox 68", _
"TextBox 63")).Select
ActiveSheet.Shapes.Range(Array("TextBox 22", "TextBox 20", "TextBox 68", _
"TextBox 63", "TextBox 1")).Select
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0
.Solid
End With
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0
.Solid
End With
ActiveCell.Offset(2, -2).Range("A1:S3").Select
ActiveSheet.Shapes.Range(Array("Rectangle 2")).Select
End Sub