Moving cursor after copyfromrecordset (1 Viewer)

CS45

Member
Local time
Today, 03:33
Joined
Jun 17, 2020
Messages
38
Hi all,

I currently have an Access macro that uses CopyFromRecordset to copy query data to a specific cell in an Excel sheet. I now want to automatically run an Excel macro that manipulates that data.
How do I move the cursor from A1 to the first cell of the new data, as that’s where my excel macro must begin from?
I’m pasting this data at the end of a long dataset in Excel using:

nextrow=ws.Range(“A” & ws.rows.Count).End(-4162).row+1
Then using CopyFromRecordset with range (“A” &nextrow)
 

Isaac

Lifelong Learner
Local time
Today, 00:33
Joined
Mar 14, 2017
Messages
8,738
You want to use Excel automation. Based on your question about moving the cursor, take my word on this - you are going down the wrong path. You are headed toward using Select, Selection, and Active/Activate in your new Excel code. Do not do that ever in Excel vba, it will blow up eventually.

What do you actually want to do? You'll need to write code to act directly on objects - like declaring and acting on your already existing ws variable, and then declaring range variables to do things with them.
 

Users who are viewing this thread

Top Bottom