Re: Importing Excel data from from to Access

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi Jennifer,

You can use syntax like this
Activeworkbook.Worksheets("CDF").Range("B6").Value
to get the contents of an individual cell.

The advantage of naming the cells instead of referring to them by
address is that if you insert or delete rows or columns, the name stays
with the cell. If you use an address like "B6" and then insert a row
above, the code will be broken until you remember to change B6 to B7.

From what you've said it sounds as if your form is an Excel work***
rather than a UserForm. Open the VBA editor (Alt-F11), go to
Tools|Options, and on the Editor tab make sure "Require variable
declaration" is checked.

Then insert a new module and paste the code into it.

Next, modify the code so it's using your names and locations for fields,
tables, the Access database, etc. To test the code, make sure the Debug
toolbar is displayed (in the VBA editor) and use the Step Into button to
step through it line by line. Once it's working, you can run it either
by selecting it from the list in Excel's Tools|Macro|Macros... command
or by putting a button on the work*** or a toolbar (see Excel help for
that).


On Thu, 2 Nov 2006 07:11:03 -0800, JenniferSharp
<JenniferSharp@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Also, how do you put the SQL into Excel? I have just used the function
features before now.

"JenniferSharp" wrote:

Will this work even if they are not in range if I just use the names of the
cells (they aren't all in one column or row, but spread out)?



--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.


Quantcast