Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to use 2 conditions in if
I am writing a macro that would importa data from a transaction file to my
report file. I need to specify 2 conditions for the loopup. Here is an examply (dummy) of what I will be writing. Please help to specify 2 conditions. thanks Dim cell As Range Dim str As String For Each cell In Range("a8:a30") If cell = 1122 Then cell.Select With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With ElseIf Not IsEmpty(cell.Value) Then cell.Select With Selection.Interior .ColorIndex = 5 .Pattern = xlSolid End With Else: Range("a33").Select ActiveCell.FormulaR1C1 = "end of transactions" End If Next cell End Sub -- Sergei D |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to use 2 conditions in if
Do you mean
If cell = 1122 Or cell = 2233 Then -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Sergei D" wrote in message ... I am writing a macro that would importa data from a transaction file to my report file. I need to specify 2 conditions for the loopup. Here is an examply (dummy) of what I will be writing. Please help to specify 2 conditions. thanks Dim cell As Range Dim str As String For Each cell In Range("a8:a30") If cell = 1122 Then cell.Select With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With ElseIf Not IsEmpty(cell.Value) Then cell.Select With Selection.Interior .ColorIndex = 5 .Pattern = xlSolid End With Else: Range("a33").Select ActiveCell.FormulaR1C1 = "end of transactions" End If Next cell End Sub -- Sergei D |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Countif Conditions - Use of conditions that vary by cell value | Excel Discussion (Misc queries) | |||
More than 3 conditions | Excel Discussion (Misc queries) | |||
2 Conditions + Sum of a colum matching those conditions | Excel Worksheet Functions | |||
shade cells based on conditions - i have more than 3 conditions | Excel Worksheet Functions | |||
How to multiple conditions to validate more than 2 conditions to . | Excel Worksheet Functions |