Basically, I have 12ish rows and 10ish columns all requiring an IF statement formula that is slightly different. I am trying to make a macros to do it all for me but I am pretty new to Macros. Because the output of the IF statement is string, the quotation marks are confusing the entire formula. Also, as shown below, I am having difficulty using the (#,#) input method for cells to put in the Formula. Range.Formula does not work for me because the letter coordinate is changing. That is unless some one knows how to do A + 1 = B. Below is my code.
Sub Create()
Dim x As Integer
Dim i As Integer
Dim y As Integer
Dim E As String
x = 8
i = 6
y = 4
For i = 6 To 16
For x = 8 To 20
Range(i, x).Formula = "=IF('Sheet2'!" & E & y & "=0,"","yes")"
' Want to put formula in Cell "i,x". Not sure how to change format from A1 to #,# in Range.
' Otherwise must use Cells(#,#) but not sure how to do Cells.Formula to work
'IF statement simply does not work. Gets confused because of the additional quotation marks
y = y + 1
Next x
x = 8
Next i
End Sub
Thanks!
Bookmarks