Hi All
I'm fairly new to VBA, but have written some code so that when a checkbox is ticked an inputbox appears, forces a user to enter data, then that input data goes into a specific cell. everything worked fine on my first one. when I try to duplicate the same thing for a different checkbox, a different inputbox and different specific cell I get an error that says
Compile error: Duplicate declaration in current scope.
This is my code for the one that works;
Private Sub CheckBoxWallType_Click()
If CheckBoxWallType.Value = True Then
Dim WallType As String
Sheets("FS").Rows("9:9").EntireRow.Hidden = False
WallType = InputBox("Specify another wall type", "Wall Type")
If Len(WallType) = 0 Then 'checks if user entry has been made
MsgBox "You have not entered a wall type. The checkbox has been unchecked", vbInformation, "You must enter a wall type" 'if no entry an error message displays
Range("B9").Value = "" 'Cell B9 is left blank
CheckBoxWallType.Value = False 'checkbox reverts back to unchecked
Sheets("FS").Rows("9:9").EntireRow.Hidden = True
End If
Range("B9").Value = WallType 'Cell B9 = user entry
Else
Range("B9:C9").Value = ""
Sheets("FS").Rows("9:9").EntireRow.Hidden = True
End If
End Sub
[/I]and this is the code for the one that doesn't;
Private Sub WallFinish_Click()
If WallFinish.Value = True Then
Dim WallFinish As String
Sheets("FS").Rows("16:16").EntireRow.Hidden = False
WallFinish = InputBox("Specify another wall finish", "Wall Finish")
If Len(WallFinish) = 0 Then 'checks if user entry has been made
MsgBox "You have not entered a wall finish. The checkbox has been unchecked", vbInformation, "You must enter a wall finish" 'if no entry an error message displays
Range("B16").Value = "" 'Cell B16 is left blank
WallFinish.Value = False 'checkbox reverts back to unchecked
Sheets("FS").Rows("16:16").EntireRow.Hidden = True
End If
Range("B16").Value = WallFinish 'Cell B16 = user entry
Else
Range("B16:C16").Value = ""
Sheets("FS").Rows("16:16").EntireRow.Hidden = True
End If
End Sub
Please help....many thanks
Bookmarks