I'm having a bit of trouble with a macro. The code is supposed to first check to see if a certain parameter called 'Setup' is True or False and then checks each sheet for the value of R43 if 'Setup' is True or R44 if 'Setup' is False. If the value in R43 or R44 is True the code highlights a cell on a different tab called 'Input' green, or red if the value is False. This is done for different cells corresponding to each worksheet checked. Below is my code.
My problem is that if R43 is TRUE and R44 is FALSE and the Setup.Value = TRUE, I should be checking R43 and coloring my cell green but for some reason I am seeing red. It seems like the code is looking at cell R44 and seeing the FALSE value, but I can't understand why. Anybody have any ideas?
Code:
Sub Tab_Change(sheet As String)
' The sheet name is provided by the calling macro on each sheet.
' Determines if in setup mode or not.
If Worksheets("Input").Setup.Value = True Then
If Worksheets(sheet).Range("r43").Value = True Then
green (sheet)
Else
Red (sheet)
End If
Else
If Worksheets(sheet).Range("r44").Value = True Then
green (sheet)
Else
Red (sheet)
End If
End If
End Sub
Sub Red(sheet As String)
Dim changedcell As String
changedcell = sheet + "cell"
'Sets sheet indicator to Red
'Worksheets("Input").Shapes(sheet).Fill.ForeColor.RGB = RGB(255, 0, 0)
Worksheets("Input").Range(changedcell) = False
End Sub
Sub green(sheet As String)
Dim changedcell As String
changedcell = sheet + "cell"
'Sets sheet indicator to Green
'Worksheets("Input").Shapes(sheet).Fill.ForeColor.RGB = RGB(0, 128, 0)
Worksheets("Input").Range(changedcell) = True
End Sub
My problem is that if R43 is TRUE and R44 is FALSE and the Setup.Value = TRUE, I should be checking R43 and coloring my cell green but for some reason I am seeing red. It seems like the code is looking at cell R44 and seeing the FALSE value, but I can't understand why. Anybody have any ideas?