cjt
12-04-2014, 11:39 AM
I have a macro which generates a new spreadsheet and within that spreadsheet it creates several check boxes and a button. The button is assigned a macro which should hide or show the check boxes if they are pertinent or not. When I attempt to run the code through the button I get the following error: Run Time error 424 Object Required. Here's some of the code:
The Check boxes are created like this:
ActiveSheet.CheckBoxes.Add(Left:=Range("E6").Left, Top:=Range("E6").Top, Width:=Range("E6").Width, Height:=Range("E6").Height).Select
With Selection
.Name = CheckBox1
.Caption = "All personal transactions have been properly Flagged"
End With
Then a separate sub contains the code for hiding or showing them attached to the button like this:
If Sheets("Review Report").Range("B6").Value > 0 Then
Sheets("Review Report").Range("B6").Interior.ColorIndex = 27
CheckBox1.Visible = True
Else:
Sheets("Review Report").Range("B6").Interior.ColorIndex = 0
CheckBox1.Visible = False
The error comes from this line:
CheckBox1.Visible = True
I wonder if the problem comes from the fact that the checkboxes are generated in one macro and then the second macro cannot find those?
The Check boxes are created like this:
ActiveSheet.CheckBoxes.Add(Left:=Range("E6").Left, Top:=Range("E6").Top, Width:=Range("E6").Width, Height:=Range("E6").Height).Select
With Selection
.Name = CheckBox1
.Caption = "All personal transactions have been properly Flagged"
End With
Then a separate sub contains the code for hiding or showing them attached to the button like this:
If Sheets("Review Report").Range("B6").Value > 0 Then
Sheets("Review Report").Range("B6").Interior.ColorIndex = 27
CheckBox1.Visible = True
Else:
Sheets("Review Report").Range("B6").Interior.ColorIndex = 0
CheckBox1.Visible = False
The error comes from this line:
CheckBox1.Visible = True
I wonder if the problem comes from the fact that the checkboxes are generated in one macro and then the second macro cannot find those?