
Signature
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
I think you'll find it works better when you define the variable iLastRow
and to be on the safe side make sure you give the macro a name and an End
Sub
Sub AddColumn()
Dim iLastRow
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Cells(iLastRow + 1, "A").Formula = "=SUM(A" & _
Range("A1").End(xlDown) & ":A" & iLastRow & ")"
End Sub
______________________
> iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
> Cells(iLastRow+1,"A").Formula = "=SUM(A" & _
[quoted text clipped - 10 lines]
>>
>> Thanks Mike.
Bob Phillips - 18 Jun 2006 13:17 GMT
It works just as well without defining it. It only doesn't work if you have
Option Explicit, and then you know quite quickly. If you are going top
declare it, at least give it a proper type (Long).
You also assume there isn't already a macro to embed this in, I didn't, but
it might help if you gave the macro a meaningful name rather than a totally
irrelevant name.
--
HTH
Bob Phillips
(replace xxxx in the email address with gmail if mailing direct)
> I think you'll find it works better when you define the variable iLastRow
> and to be on the safe side make sure you give the macro a name and an End
[quoted text clipped - 33 lines]
> >>
> >> Thanks Mike.