Hello: I have a loop that is filling in formulas based on a cell value. The formula for "A" is fairly simple and is included in the code as a formula. But the one for "AB" has a lot of nested ifs and it's so long, I couldn't get it to work -- I kept getting syntax errors. So, I decided to simply copy the "AB" formula from a cell on the sheet and then loop through copying the formula. It works, but it flashes a ton (even with screen updating off) and seems to be working really hard at it. Anyway, is there a more efficient way to deal with a long nested formula in the code itself? Or am I left with 1. my current copying loop or 2. back to trouble shooting the syntax error. Any help would be appreciated. Thanks!
Code:
Dim VCell As Range
Set VCell = VSh.Cells
Dim DataSh As Worksheet
Set DataSh = UWkbk.Worksheets("Data")
For i = 1 To 300
With VCell(i, 15)
If VCell(i, 16).Value = "A" Then
.Formula = "=" & VCell(i, 14).Address(0, 0)
Else
If VCell(i, 16).Value = "AB" Then
DataSh.Range("P4").Copy
.PasteSpecial Paste:=xlPasteFormulas
Else
End If
End If
End With
Next i