ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error 1004 Application Defined or Object Defined Error (https://www.excelbanter.com/excel-programming/312038-error-1004-application-defined-object-defined-error.html)

Garry[_6_]

Error 1004 Application Defined or Object Defined Error
 
Hi

I have a user form that fills in the sheet payments once the add btn
is clicked. This was working fine, then I start getting the above
error. I had done more design changes to the form but since this error
I have put everything back to working design.

Private Sub cmdAddBtn1_Click()
ActiveWorkbook.Sheets("Payments").Activate
*Sheets("HEA Payments").Select - tried inserting this line but no
effect
Range("A1").End(xlDown).Offset(1, 0).Select



If txtPm.Value = "" Then

txtPm.Value = txtAuth.Value

Else: txtPm.Value = txtPm.Value

End If
ActiveCell.Value = txtDate.Value

ActiveCell.Offset(0, 1) = txtScheme.Value

ActiveCell.Offset(0, 2) = txtAuth.Value

ActiveCell.Offset(0, 3) = txtPm.Value

ActiveCell.Offset(0, 4) = txtAmount.Value

ActiveCell.Offset(0, 5) = txtContractor.Value

ActiveCell.Offset(0, 6) = txtInvoice.Value

ActiveCell.Offset(0, 7) = txtTheirref.Value

ActiveCell.Offset(0, 8) = txtComments.Value


End Sub

Thanks garry.

Winxp xl2k

Tom Ogilvy

Error 1004 Application Defined or Object Defined Error
 
suspect you changed the name of one of your textboxes. which line is
highlighted when you get the error?

--
Regards,
Tom Ogilvy

"Garry" wrote in message
om...
Hi

I have a user form that fills in the sheet payments once the add btn
is clicked. This was working fine, then I start getting the above
error. I had done more design changes to the form but since this error
I have put everything back to working design.

Private Sub cmdAddBtn1_Click()
ActiveWorkbook.Sheets("Payments").Activate
*Sheets("HEA Payments").Select - tried inserting this line but no
effect
Range("A1").End(xlDown).Offset(1, 0).Select



If txtPm.Value = "" Then

txtPm.Value = txtAuth.Value

Else: txtPm.Value = txtPm.Value

End If
ActiveCell.Value = txtDate.Value

ActiveCell.Offset(0, 1) = txtScheme.Value

ActiveCell.Offset(0, 2) = txtAuth.Value

ActiveCell.Offset(0, 3) = txtPm.Value

ActiveCell.Offset(0, 4) = txtAmount.Value

ActiveCell.Offset(0, 5) = txtContractor.Value

ActiveCell.Offset(0, 6) = txtInvoice.Value

ActiveCell.Offset(0, 7) = txtTheirref.Value

ActiveCell.Offset(0, 8) = txtComments.Value


End Sub

Thanks garry.

Winxp xl2k




Garry[_7_]

Error 1004 Application Defined or Object Defined Error
 
I have added the full reference Sheet(..) to
Range("A1").End(xlDown).Offset(1, 0).Select


That seems to do the trick.

I found this

http://support.microsoft.com/default.aspx?kbid=178510

Until my next problem Tx all

garry

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com