cogswel__cogs
Board Regular
- Joined
- Jan 3, 2018
- Messages
- 168
I can use VBA to create conditional formatting where cells is highlighted yellow if range in column N does not equal column x
But as my program wants might want to change n2 or x2.
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=N2<>X2"
How can I write this where I have flexibility to change the column. The" " throw me off nd I can't seem to make it work not hard coded.
So say I had a string value vl with a value of "E"
I'd like to say
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= & vl & "2<>X2"
any help is appreciated.
But as my program wants might want to change n2 or x2.
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=N2<>X2"
How can I write this where I have flexibility to change the column. The" " throw me off nd I can't seem to make it work not hard coded.
So say I had a string value vl with a value of "E"
I'd like to say
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= & vl & "2<>X2"
any help is appreciated.