Subroutine will not work

MrBaldGuy

New Member
Joined
Mar 7, 2002
Messages
4
I downloaded an excel file that demonstrated the use of a userform inserting, deleting, and editing records in a database. When I activated the code in the file that I downloaded, all worked well. I had another project that I am working on and this looked like the perfect code that I needed to perform the above in my file. After copying the code from the downloaded file to my module (and not having it to work) and then typing in the code, and still not having it to work, I decided it was time I seeked help from the masters. The following is the subroutine I have been trying to call.

Sub GetData()
With Me
.TextA = Range("Database").Cells(iRowNumber, 1)
.TextB = Range("Database").Cells(iRowNumber, 2)
.TextC = Range("Database").Cells(iRowNumber, 3)
.TextD = Range("Database").Cells(iRowNumber, 4)
End With
End Sub

When the above sub is called, I always receive the error: Run-time error '1004'
Application-defined or object-defined error.

Oh yes, by the way, my module begins with...
Option Explicit
Dim iRowNumber As Integer.

I have checked spelling, and everything seems to correspond with the downloaded file, but I keep getting the error.

Any help would be greatly appreciated.
MrBaldGuy
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top