ExcelNovice
Well-known Member
- Joined
- May 12, 2002
- Messages
- 583
I'm using the following code to change the column width on two worksheets (Vehicles and CarsOnly), but while it's working on the Vehicles sheet, I'm getting an error on the CarsOnly sheet and I'm not sure what changes to make to the code. Everything in blue works as it should, but I'm getting error after that, and nothing in red works. Help please. Thanks.
Private Sub OptionButton1_Click()
ActiveSheet.Unprotect Password:="password1"
Range("OK63") = "200"
Range("ki42") = "200"
Sheets("CarsOnly").Range("ki42") = "200"
Range("bt42").Select
Columns("BR:EO").ColumnWidth = 0
Sheets("CarsOnly").Select
Columns("BR:EO").Select
Selection.ColumnWidth = 0
Range("BK45").Select
Sheets("Vehicles").Select
Range("BK45").Select
ActiveSheet.Protect Password:="password1"
End Sub
Private Sub OptionButton1_Click()
ActiveSheet.Unprotect Password:="password1"
Range("OK63") = "200"
Range("ki42") = "200"
Sheets("CarsOnly").Range("ki42") = "200"
Range("bt42").Select
Columns("BR:EO").ColumnWidth = 0
Sheets("CarsOnly").Select
Columns("BR:EO").Select
Selection.ColumnWidth = 0
Range("BK45").Select
Sheets("Vehicles").Select
Range("BK45").Select
ActiveSheet.Protect Password:="password1"
End Sub