Hello,
I'm having trouble with this. I'm trying to enter :
=IF(A?="","YES","NO")
Into certain cells where the question mark references whichever row the loop is on, however I'm having trouble getting the row reference into the formula. So far I have :
Where all the "comments" are failed tries. If someone could please point to what I'm doing wrong I would greatly appreciate it.
I'm having trouble with this. I'm trying to enter :
=IF(A?="","YES","NO")
Into certain cells where the question mark references whichever row the loop is on, however I'm having trouble getting the row reference into the formula. So far I have :
VBA Code:
Sub formval()
Dim c As Range
Dim MyRange As Range
Dim MyFormula As String
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & lastrow)
'MyFormula = "=IF(A" & Row & "= " & Chr(34) & "," & Chr(34) & "YES" & Chr(34) & "," & Chr(34) & "NO" & Chr(34) & ")"
' MyFormula = "=IF(A" & Row & "="""",""YES"",""NO"")"
'MyFormula = "A" & c.Offset(0, 0)
'MyFormula = c.Formula
For Each c In MyRange
If InStr(c.value, "Load No.") > 0 Then
c.EntireRow.Interior.ColorIndex = 17
ElseIf InStr(c.value, "Dispt. Lim.") > 0 Then
c.EntireRow.Interior.ColorIndex = 17
ElseIf Not InStr(c.value, "Load No.") Or InStr(c.value, "Load Date") Then
' c.Offset(0, 20).value = "=IF(A:" & Row & "=""""" & ",""YES"",""NO"")"
' c.Offset(0, 20).value = MyFormula
' c.Offset(0, 20).value = "=IF(A" & Row & "= " & Chr(34) & "," & Chr(34) & "YES" & Chr(34) & "," & Chr(34) & "NO" & Chr(34) & ")"
' "=IF(A" &row & "=" & chr(34) &",""YES","NO")
End If
Next
End Sub
Where all the "comments" are failed tries. If someone could please point to what I'm doing wrong I would greatly appreciate it.