Hey everyone,
I've written a Macro that Tries to control the coloring of certain cells in File "Y", by using certain values in File "X" that represent the months and quarter of the year.
My problem is that even when the values in File X change, the colors in File Y are not changing correctly.
Here's the code I've written so far:
If Workbooks("File X.xlsm").Sheets(1).Range("B11").Value = 2 And Workbooks("File X.xlsm").Sheets(1).Range("B12").Value = 2 Or 5 Or 8 Or 11 Then Workbooks("File Y.xlsm").Sheets(6).Range("E19:J41").Interior.Color = RGB(51, 51, 51)
If Workbooks("File X.xlsm").Sheets(1).Range("B11").Value = 2 And Workbooks("File X.xlsm").Sheets(1).Range("B12").Value = 2 Or 5 Or 8 Or 11 Then Workbooks("File Y.xlsm").Sheets(6).Range("I46:I48, I51:I54, I58:I59, I62:I68, I73:I75, I78:I81, I85:I86, I89:I95, I106:I108").Interior.Color = RGB(79, 129, 189)
If Workbooks("File X.xlsm").Sheets(1).Range("B11").Value = 3 And Workbooks("File X.xlsm").Sheets(1).Range("B12").Value = 3 Or 6 Or 9 Or 12 Then Workbooks("File Y.xlsm").Sheets(6).Range("E19:J41, E46:J68").Interior.Color = RGB(51, 51, 51)
If Workbooks("File X.xlsm").Sheets(1).Range("B11").Value = 1 And Workbooks("File X.xlsm").Sheets(1).Range("B12").Value = 1 Or 3 Or 5 Or 7 Then Workbooks("File Y.xlsm").Sheets(6).Range("E19:J41, E46:J68").Interior.Color = RGB(255, 255, 255)
If Workbooks("File X.xlsm").Sheets(1).Range("B11").Value = 1 And Workbooks("File X.xlsm").Sheets(1).Range("B12").Value = 1 Or 3 Or 5 Or 7 Then Workbooks("File Y.xlsm").Sheets(6).Range("I19:I21, I24:I27, I31:I32, I35:I41, I46:I48, I51:I54, I58:I59, I62:I68, I73:I75, I78:I81, I85:I86, I89:I95, I106:I108").Interior.Color = RGB(79, 129, 189)
If Workbooks("File X.xlsm").Sheets(1).Range("B11").Value = 3 And Workbooks("File X.xlsm").Sheets(1).Range("B12").Value = 3 Or 6 Or 9 Or 12 Then Workbooks("File Y.xlsm").Sheets(6).Range(" I73:I75, I78:I81, I85:I86, I89:I95, I106:I108").Interior.Color = RGB(79, 129, 189)
Basically, I'm trying to grey out certain tables if there is a change in the month, but keep certain cells blue. I've written codes to try to replicate this coloring for the first month of the quarter, the second month of the quarter, and the 3rd month of the quarter.
But the coloring isn't working. I'm also having similar problems with getting certain cells to lock depending on the month in the quarter. Is there a way to better control my conditions for "If, then"?
Thanks, any help would be greatly appreciated,
jning
Bookmarks