Hi,
I have a long sub that goes column by column and does various formatting. In the below section of code it conditionally formats a column based on the column number. Unfortunate when the raw data is imported into the sheet it will sometimes not line up correctly but the column names will be consistent. So I would like to migrate away from a hard location and instead dynamically find the column name and do the formatting based on that.
In the below code the column name will always be "Long".
Thank you in advance for your assistance.
I have a long sub that goes column by column and does various formatting. In the below section of code it conditionally formats a column based on the column number. Unfortunate when the raw data is imported into the sheet it will sometimes not line up correctly but the column names will be consistent. So I would like to migrate away from a hard location and instead dynamically find the column name and do the formatting based on that.
In the below code the column name will always be "Long".
Thank you in advance for your assistance.
Code:
Columns("AM:AM").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=251"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False