View Single Post
 
Old 06-16-2012, 02:18 PM
ue418 ue418 is offline Windows 7 32bit Office 2000
Novice
 
Join Date: May 2012
Posts: 17
ue418 is on a distinguished road
Default A related question on this macro

Hello Again. Regarding the macro in the above posts, I would like for the macro to place the data in A3 of a specific sheet. Let's say it is named "Sheet1". The current line is of the form:

With ActiveSheet.QueryTables...

Can I simply change "ActiveSheet" in that line to "Sheet1"? I have a feeling that is too obvious/simple, and there is some special format I must use? The deal is, the macro button (unfortunately) shows up on every sheet of the workbook. As long as the user clicks the macro when he is on "Sheet1", the data (correctly) goes into Sheet1. But if he clicks the macro button when he is on, say, Sheet 2, then the data will go into Sheet 2, since it is the active sheet. I want the data to ALWAYS go into Sheet 1. If anyone can help me out, I would greatly appreciate it.

Rick

UPDATE:
I substituted Sheets("Sheet1") for ActiveSheet in that line, and I got a VB run-time error saying "the destination range is not on the same worksheet that the Query table is being created on". That happened when I clicked the macro on Sheet 2. When I click the macro on Sheet 1, everything works fine. Can I not do it from a different sheet? I would appreciate any help you could give me.

Last edited by ue418; 06-16-2012 at 02:35 PM. Reason: Have new information
Reply With Quote