PDA

View Full Version : compiled error of "method or data member not found excel".



mzsuga
06-25-2009, 02:00 PM
I get a compiled error of "method or data member not found excel". Anyone know what's wrong?

If Worksheets.Name = "Mail Plan Details" Then
Dim n As Long
n = Cells(Rows.Count, "H").End(xlUp).row + 1
Cells(n, "A").Value = "Grand Total"
Cells(n, "H").Formula = "=sum(H6:H" & n - 1 & ")"
Cells(n, "j").Formula = "=sum(j6:j" & n - 1 & ")"
Cells(n, "k").Formula = "=sum(k6:k" & n - 1 & ")"
Cells(n, "l").Formula = "=sum(l6:l" & n - 1 & ")"
Cells(n, "m").Formula = "=sum(m6:m" & n - 1 & ")"
Cells(n, "n").Formula = "=sum(n6:n" & n - 1 & ")"
Cells(n, "q").Formula = "=sum(n6:n" & n - 1 & ")"
Cells(n, "r").Formula = "=sum(n6:n" & n - 1 & ")"
End If

stanleydgrom
06-25-2009, 03:55 PM
mzsuga,

Try:




Sub Test()
Dim n As Long
With Worksheets("Mail Plan Details")
n = Cells(Rows.Count, "H").End(xlUp).Row + 1
Cells(n, "A").Value = "Grand Total"
Cells(n, "H").Formula = "=sum(H6:H" & n - 1 & ")"
Cells(n, "j").Formula = "=sum(j6:j" & n - 1 & ")"
Cells(n, "k").Formula = "=sum(k6:k" & n - 1 & ")"
Cells(n, "l").Formula = "=sum(l6:l" & n - 1 & ")"
Cells(n, "m").Formula = "=sum(m6:m" & n - 1 & ")"
Cells(n, "n").Formula = "=sum(n6:n" & n - 1 & ")"
Cells(n, "q").Formula = "=sum(n6:n" & n - 1 & ")"
Cells(n, "r").Formula = "=sum(n6:n" & n - 1 & ")"
End With
End Sub