On May 6, 1:36 pm, ryguy7272
wrote:
Here is my code now:
For fCtr = LBound(myNames) To UBound(myNames)
Set tempWkbk = Workbooks.Open(Filename:=myPath & myNames(fCtr))
lastrow = Cells(Rows.Count, "F").End(xlUp).Row
For Each c In Range("F2:F" & lastrow)
If c.Value < "" Then
c.Offset(, 20).Value = "=IF(RC[-20]<"""",RC[-17]*RC[-3])"
Next c
'Columns("B:B").Select
'Selection.Insert Shift:=xlToRight
tempWkbk.Close savechanges:=True
Next fCtr
I keep getting a Next Without For error. this line seems to be the culprit:
Next c
Not sure why though...
Sorry Gary, I recorded a macro and got a slightly different value
(requirements changed) as seen above. It just seemed easier to use this than
to use the value that you sent to me.
--
RyGuy
The IF block within the innermost FOR is not closed.
For Each c In Range("F2:F" & lastrow)
If c.Value < "" Then
c.Offset(, 20).Value = "=IF(RC[-20]<"""",RC[-17]*RC[-3])"
end if
Next c
Indenting helps avoid such problems.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/