Run-time Error 1004, Please Help

R

RPIJG

This is the code, and it keeps giving me a Run-time error 1004 which th
debugger picks up the first line beginning with .Range

Private Sub CommandButton1_Click()
Dim iLastRow As Long
With Worksheets("MonthlyTotals")
iLastRow = .Cells(Rows.Count,"A").End(xlUp)>Row
.Range("A" & iLastRow).Value = Worksheets("Sales Invoice"). _
Range("O45").Value
.Range("B" & iLastRow).Value = Worksheets("Sales Invoice"). _
Range("O37").Value
.Range("C" & iLastRow).Value = Worksheets("Sales Invoice"). _
Range("O40").Value
.Range("D" & iLastRow).Value = Worksheets("Sales Invoice"). _
Range("P43").Value
End With
End Sub


Thanks for all your hel
 
B

Bob Phillips

Replied in previous thread. It was my typo

Private Sub CommandButton1_Click()
Dim iLastRow As Long
With Worksheets("MonthlyTotals")
iLastRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1
.Range("A" & iLastRow).Value = Worksheets("Sales Invoice"). _
Range("O45").Value
.Range("B" & iLastRow).Value = Worksheets("Sales Invoice"). _
Range("O37").Value
.Range("C" & iLastRow).Value = Worksheets("Sales Invoice"). _
Range("O40").Value
.Range("D" & iLastRow).Value = Worksheets("Sales Invoice"). _
Range("P43").Value
End With
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top