ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Including a variable into formatconditions (https://www.excelbanter.com/excel-programming/373051-including-variable-into-formatconditions.html)

Chris

Including a variable into formatconditions
 
I am trying to convert the cell reference in the formula1 from a specific
cell to a program selected cell;

B391 to cells(rowindex,columnindex)

(actual code)
Range("B996:Y998").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=AND(B391=1)"

everything I try turns into an error

Selection.FormatConditions(1).Interior.Pattern = xlGrid



Tom Ogilvy

Including a variable into formatconditions
 
Formula1:="=AND(" & Cells(rowindex,columnindex).Address(0,0) & "=1)"

--
Regards,
Tom Ogilvy


"Chris" wrote in message
...
I am trying to convert the cell reference in the formula1 from a specific
cell to a program selected cell;

B391 to cells(rowindex,columnindex)

(actual code)
Range("B996:Y998").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=AND(B391=1)"

everything I try turns into an error

Selection.FormatConditions(1).Interior.Pattern = xlGrid





Chris

Including a variable into formatconditions
 
Thanks. I'll try this Monday when I get back to work

"Tom Ogilvy" wrote:

Formula1:="=AND(" & Cells(rowindex,columnindex).Address(0,0) & "=1)"

--
Regards,
Tom Ogilvy


"Chris" wrote in message
...
I am trying to convert the cell reference in the formula1 from a specific
cell to a program selected cell;

B391 to cells(rowindex,columnindex)

(actual code)
Range("B996:Y998").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=AND(B391=1)"

everything I try turns into an error

Selection.FormatConditions(1).Interior.Pattern = xlGrid







All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com