Hi,
I have a button in my Access database that runs four queries and displays the results. The queries are designed in such a way that I know in advance how many rows and columns they will have and this won't change. The queries are named "qryExec01", "qryExec02" etc.
I have an Excel spreadsheet called "Exec and RDMs report.xlsx" which contains a sheet called "Main Setup sheet". I have prepared certain areas of that sheet to hold the output of my four queries (then other sheets feed off that). But at the moment I am copying and pasting manually. My plan is to replicate this approx 30 more times so I need to automate it.
I paste qryExec01 to cells B601:E632. I paste qryExec02 to cells C685:J701. And other predefined areas for the others. In each case I overwrite what was there before.
The full path of the spreadsheet is G:\Database\Exec and RDMs Report.xlsx and I don't ever need to change this, the name of the worksheet or the locations of the cells within it.
The spreadsheet will already be open as I will be doing other things with it, and then grabbing data from my database. So ideally, I don't want to have to close it before clicking the button. There may be other Excel workbooks open at the same time, just in case that complicates things.
Given the set-up as described, can someone tell me the code to put on my button's OnClick event?
Thank you.
I have a button in my Access database that runs four queries and displays the results. The queries are designed in such a way that I know in advance how many rows and columns they will have and this won't change. The queries are named "qryExec01", "qryExec02" etc.
I have an Excel spreadsheet called "Exec and RDMs report.xlsx" which contains a sheet called "Main Setup sheet". I have prepared certain areas of that sheet to hold the output of my four queries (then other sheets feed off that). But at the moment I am copying and pasting manually. My plan is to replicate this approx 30 more times so I need to automate it.
I paste qryExec01 to cells B601:E632. I paste qryExec02 to cells C685:J701. And other predefined areas for the others. In each case I overwrite what was there before.
The full path of the spreadsheet is G:\Database\Exec and RDMs Report.xlsx and I don't ever need to change this, the name of the worksheet or the locations of the cells within it.
The spreadsheet will already be open as I will be doing other things with it, and then grabbing data from my database. So ideally, I don't want to have to close it before clicking the button. There may be other Excel workbooks open at the same time, just in case that complicates things.
Given the set-up as described, can someone tell me the code to put on my button's OnClick event?
Thank you.