HardAtWork
Board Regular
- Joined
- Sep 17, 2010
- Messages
- 52
I've been working on this for a while now...and I've gotten the form to work great on 2007. The problem comes in when trying to use the form in 2003.
Here's my goal.
Have a button that changes the color of the font and interior of the cells when selected and then change them back when it's selected again.
Works fine in 2007, but in 2003 I get a run-time error of 1004 stating that it can not change the interior of the cell.
Mode #1: 80% Gray interior and Green Font
Mode #2: White interior and Black Font
Here's a very short version of the coding:
If application.Version = "11.0" or "12.0" or "14.0" Then
ActiveWorkbook.Unprotect ("Password")
Application.ScreenUpdating = False
Worksheets("Page One").Select
Range("A1:ZZ100").Select
With Selection.Interior
.ColorIndex = 56
.Pattern = xlSolid
End With
With Selection.Font
.ColorIndex = 4
End With
If Me.CommandButton3.Caption = "Dark" Then
Me.CommandButton3.Caption = "Light"
Else
Me.CommadButton3.Caption = "Dark"
End If
End If
Application.ScreenUpdating = False
ActiveWorkbook.Protect ("Password")
If application.Version = "11.0" or "12.0" or "14.0" Then
ActiveWorkbook.Unprotect ("Password")
Application.ScreenUpdating = False
Worksheets("Page One").Select
Range("A1:ZZ100").Select
With Selection.Interior
.ColorIndex = 2 (This is where it states the problem is)
.Pattern = xlSolid
End With
With Selection.Font
.ColorIndex = 56
End With
End If
Application.ScreenUpdating = False
ActiveWorkbook.Protect ("Password")
The above coding is all together and I'm not sure that I know how to seperate it if I had to. I would like the coding to stay together as it make changing it easier on the person behind.
If ya'll could please help that would be great.
Here's my goal.
Have a button that changes the color of the font and interior of the cells when selected and then change them back when it's selected again.
Works fine in 2007, but in 2003 I get a run-time error of 1004 stating that it can not change the interior of the cell.
Mode #1: 80% Gray interior and Green Font
Mode #2: White interior and Black Font
Here's a very short version of the coding:
If application.Version = "11.0" or "12.0" or "14.0" Then
ActiveWorkbook.Unprotect ("Password")
Application.ScreenUpdating = False
Worksheets("Page One").Select
Range("A1:ZZ100").Select
With Selection.Interior
.ColorIndex = 56
.Pattern = xlSolid
End With
With Selection.Font
.ColorIndex = 4
End With
If Me.CommandButton3.Caption = "Dark" Then
Me.CommandButton3.Caption = "Light"
Else
Me.CommadButton3.Caption = "Dark"
End If
End If
Application.ScreenUpdating = False
ActiveWorkbook.Protect ("Password")
If application.Version = "11.0" or "12.0" or "14.0" Then
ActiveWorkbook.Unprotect ("Password")
Application.ScreenUpdating = False
Worksheets("Page One").Select
Range("A1:ZZ100").Select
With Selection.Interior
.ColorIndex = 2 (This is where it states the problem is)
.Pattern = xlSolid
End With
With Selection.Font
.ColorIndex = 56
End With
End If
Application.ScreenUpdating = False
ActiveWorkbook.Protect ("Password")
The above coding is all together and I'm not sure that I know how to seperate it if I had to. I would like the coding to stay together as it make changing it easier on the person behind.
If ya'll could please help that would be great.