Hello,
I am currently receiving an error while trying to reference a cell using an ActiveCell.Offset Command. I must not be using it correctly.
I cannot reference the cell directly because it is not always in the same location. and resolution ideas?
Here is the code:
'Start new variants
Dim BidLabTot As Variant
Dim BidMatTot As Variant
Dim BidSubTot As Variant
Dim BidRenTot As Variant
Dim BidOwnTot As Variant
Dim BidTot As Variant
' Setting the variants to equal the correct values
BidLabTot = ThisWorkbook.Sheets("CODESHEET UNSORTED").Range(ActiveCell.Offset(6, 0)).Value
BidMatTot = ThisWorkbook.Sheets("CODESHEET UNSORTED").Range(ActiveCell.Offset(6, 1)).Value
BidSubTot = ThisWorkbook.Sheets("CODESHEET UNSORTED").Range(ActiveCell.Offset(6, 2)).Value
BidRenTot = ThisWorkbook.Sheets("CODESHEET UNSORTED").Range(ActiveCell.Offset(6, 3)).Value
BidOwnTot = ThisWorkbook.Sheets("CODESHEET UNSORTED").Range(ActiveCell.Offset(6, 4)).Value
BidTot = ThisWorkbook.Sheets("CODESHEET UNSORTED").Range(ActiveCell.Offest(6, 5)).Value
Then I am also concerned I am not using the Variants correctly in the conditional formatting, however, I don't know this for sure because I haven't gotten this far yet.
Here is the code showing how I am using the variants above to conditional format them (the goal is to turn the active cell green and bold (with white letters) when the cells values are within .5).
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:=BidLabTot - 0.5, Formula2:=BidLabTot + 0.5
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5287936
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Thank you all.
Bookmarks