PDA

View Full Version : Compile Error Variable Not Defined



sooty8
07-18-2013, 04:12 AM
Hi All

I have been messing about with this for a couple hours and still cannot sort it the line throwing the error is coloured blue.


If Me.TbPos.Value <> "1st" Then Cells(freerownum, 6).Value = 0
i = Cells(Rows.Count, 5).End(x1Up).Row
Cells(i, 5).Formula = "=SUM(R2C5:R" & (i - 2) & "C)"
Cells(i, 6).Formula = "=SUM(R2C6:R" & (i - 2) & "C)"
End With

Any Help much appreciated

Regards
Sooty8

p45cal
07-18-2013, 04:53 AM
i = Cells(Rows.Count, 5).End(x1Up).Row
That should be xlUp not x1Up (an L not a one).
You may also be missing
Dim i as Long somewhere near the top of your macro.

sooty8
07-18-2013, 05:34 AM
Hi p45cal

72 years of age and I'm still as stupid as I was at 11.

Thanks for the help

Regards Sooty8