Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default excel runtime 1004

I am putting a front end on an excel worksheet. I got the basics input
and I am testing it with one field. I get a runtime error of 1004.
Application-defined or Object-define error.

Here is my code:
Private Sub cmdAdd_Click()

Dim iRow As Long
Dim ws As New Worksheet
Set ws = Worksheets("MayerInsInfo")

'find the first row in the sheet
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(2, 0)

'copy the data to the database
ws.Cells(iRow, 2) = Me.txtFName.Value <-- highlights with error.

End Sub


Any suggestions would be greatly appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default excel runtime 1004

Hi lmnorms1,

Try changing:

iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(2, 0)



to

iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(2, 0).Row


---
Regards,
Norman


wrote in message
ps.com...
I am putting a front end on an excel worksheet. I got the basics input
and I am testing it with one field. I get a runtime error of 1004.
Application-defined or Object-define error.

Here is my code:
Private Sub cmdAdd_Click()

Dim iRow As Long
Dim ws As New Worksheet
Set ws = Worksheets("MayerInsInfo")

'find the first row in the sheet
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(2, 0)

'copy the data to the database
ws.Cells(iRow, 2) = Me.txtFName.Value <-- highlights with error.

End Sub


Any suggestions would be greatly appreciated.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default excel runtime 1004

Thank you that worked.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel chart export error runtime 1004 Mau Charts and Charting in Excel 3 August 17th 05 11:35 AM
excel chart export error runtime 1004 Mau[_2_] Excel Programming 0 August 4th 05 09:53 PM
excel 2002 runtime error 1004 xenod Excel Programming 3 April 6th 05 09:40 AM
Excel 2002 Data Forms runtime error 1004 Charles Osborne Excel Programming 6 May 2nd 04 03:46 AM


All times are GMT +1. The time now is 09:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"