Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 2
Default Macro beginner help with making tables

Hi,

I'm new to Macros and have no prior programming experience. I have 2 weekly files that always contains the same number of columns but different number of rows [ex. 1 week it will have 3K rows, another week it will have 2K rows, but always 6 columns]. I need to make the two sheets into table to do further analysis; can anyone please help?

I want to write a code that allows me to do the following in the following order:

1. Select only cells that contains data in sheet 1
2. make a table using data selected in sheet1
3. move to 'sheet2'
4. select only cells that contains data in 'sheet2'
5. make a table using the data in 'sheet2'

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Macro beginner help with making tables

Hello,

I think that you could do this without the use of macros. If you use data connections to create a query table, you could update the sheets each week simply by refreshing the workbook. Here are the steps I took (XL 2007):

1. Data Get External Data From Other Sources From Microsoft Query
2. Select the Excel data source and click OK
3. Select the source workbook and click OK
4. If both sheets' tables show up in the list, click "Cancel" and then "Yes" to continue editing the query in Microsoft Query (if the tables don't show up, cancel and click No, then apply names to the data ranges and save to try and help the driver find the data)
5. Click "Close" and then click the SQL button to type in a SQL statement.
6. The SQL statement that I used (you'll need to change the file location and table names accordingly) was:

SELECT Table1.*
FROM `C:\Documents and Settings\Book1.xlsx`.Table1 Table1

UNION ALL

SELECT Table2.*
FROM `C:\Documents and Settings\Book1.xlsx`.Table2 Table2

7. Click OK to the message about not displaying the query graphically.
8. Click Return Data to Excel button, choose a location for your new table, and click OK.

Now, whenever your data changes, just make sure that any named ranges refer to the correct rows and refresh the workbook.

Hope this helps,

Ben
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
combining pivot tables, then making a ranges. HoganD87 Excel Discussion (Misc queries) 1 September 4th 07 07:52 PM
Macro for a beginner Masha Excel Discussion (Misc queries) 2 February 14th 06 06:42 AM
macro beginner Erica Excel Programming 1 July 29th 05 04:09 PM
macro help for a beginner Danz[_2_] Excel Programming 0 November 14th 04 10:56 AM
macro help for a beginner Danz Excel Programming 2 November 14th 04 10:20 AM


All times are GMT +1. The time now is 06:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"