Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet If Statement in VBA
I am using following line of code:
Range("M" & vTargetRow).Formula = _ "=IF(AND(""F" & vTargetRow = "Standard Desktop"",""G" & vTargetRow = "Standard 17" & """" & " Monitor""),1,"")" Instead displaying 1 if condition true or <blank if false, it fill TargetCell with "FALSE". IF statemetn is fine if directely entered in Worksheet (=IF(AND(F500="Standard Desktop",G500="Standard 17"&""""&" Monitor"),1,"")) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet If Statement in VBA
Range("M" & vTargetRow).Formula "=IF(AND(F" & vTargetRow &"= ""Standard
Desktop"",G" & vTargetRow &"=""Standard 17"" & """""""" & "" Monitor""),1,"""")" "Atif" wrote in message ... I am using following line of code: Range("M" & vTargetRow).Formula = _ "=IF(AND(""F" & vTargetRow = "Standard Desktop"",""G" & vTargetRow = "Standard 17" & """" & " Monitor""),1,"")" Instead displaying 1 if condition true or <blank if false, it fill TargetCell with "FALSE". IF statemetn is fine if directely entered in Worksheet (=IF(AND(F500="Standard Desktop",G500="Standard 17"&""""&" Monitor"),1,"")) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet If Statement in VBA
This should help you. I had to split it up to figure it out.
Dim vTargetRow As Long Dim myString As String vTargetRow = 1 myString = "=IF(AND(F" & vTargetRow & "=""Standard Desktop""" myString = myString & ", G" & vTargetRow & "=""Standard 17""" myString = myString & """" & " Monitor""),1,"""")" Debug.Print myString Range("M" & vTargetRow).Formula = myString -- HTH, Barb Reinhardt "Atif" wrote: I am using following line of code: Range("M" & vTargetRow).Formula = _ "=IF(AND(""F" & vTargetRow = "Standard Desktop"",""G" & vTargetRow = "Standard 17" & """" & " Monitor""),1,"")" Instead displaying 1 if condition true or <blank if false, it fill TargetCell with "FALSE". IF statemetn is fine if directely entered in Worksheet (=IF(AND(F500="Standard Desktop",G500="Standard 17"&""""&" Monitor"),1,"")) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet If Statement in VBA
mystring returns 19 Monitor19 Monitor
at traget cell it should be entered as 19 Monitor 19 Monitor how to included Alt+Enter key using VBA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
If statement to go through every worksheet | Excel Discussion (Misc queries) | |||
If statement to copy an entire row to other worksheet w/ in same b | Excel Worksheet Functions | |||
Set statement for non active worksheet | Excel Programming | |||
if statement in worksheet | Excel Worksheet Functions | |||
Worksheet code if-color-statement | Excel Programming |