PC Review


Reply
Thread Tools Rate Thread

Copy from various sheets and create a master list.

 
 
J.W. Aldridge
Guest
Posts: n/a
 
      6th Oct 2006
Looking to perfect a macro....
I have 6 sheets, each named Monday - Saturday.
Each one has a specific web query on them begining in cell a1
(specifically a1 to G).
I need my macro to copy the data from each sheet and paste it on the
"Sorter Sheet" creating one list for the week.

In plain words....

(1) Update all web queries in book.
(2) Copy all data from Monday and paste starting with A1 on 'sorter
sheet'.
(3) Copy all data from Tuesday and paste on next available row on
'sorter sheet'.
(4)Copy all data from Wednesday and paste on next available row on
'sorter sheet'.
(5) ...and so on until Saturday sheet.

Any help will be greatly appreciated.
Thanx

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      6th Oct 2006

Sub CopyData()
Dim va s Variant, i as Long, sh as worksheet
Dim rng as Range, rng1 as Range
dim sh1 as Worksheet

v = Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
for i = lbound(v) to ubound(v)
set sh = worksheets(v(i))
sh.querytables(1).Refresh BackgroundQuery:=False
Next
set sh1 = Worksheets("shorter")
sh1.Cells.Clearcontents
for i = lbound(v) to ubound(v)

set sh = worksheets(v(i))
set rng = sh.Range("A1").currentRegion
set rng1 = sh1.Cells(rows.count,1).End(xlup)
if not isempty(rng1) then set rng1 = rng1(2)
rng.copy
rng1.Pastespecial xlValues
next
End sub

--
Regards,
Tom Ogilvy


"J.W. Aldridge" wrote:

> Looking to perfect a macro....
> I have 6 sheets, each named Monday - Saturday.
> Each one has a specific web query on them begining in cell a1
> (specifically a1 to G).
> I need my macro to copy the data from each sheet and paste it on the
> "Sorter Sheet" creating one list for the week.
>
> In plain words....
>
> (1) Update all web queries in book.
> (2) Copy all data from Monday and paste starting with A1 on 'sorter
> sheet'.
> (3) Copy all data from Tuesday and paste on next available row on
> 'sorter sheet'.
> (4)Copy all data from Wednesday and paste on next available row on
> 'sorter sheet'.
> (5) ...and so on until Saturday sheet.
>
> Any help will be greatly appreciated.
> Thanx
>
>

 
Reply With Quote
 
J.W. Aldridge
Guest
Posts: n/a
 
      6th Oct 2006

Thanx Tom.
However, getting error on the following:

Dim va s Variant, i as Long, sh as worksheet

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      6th Oct 2006
Dim v as Variant, i as Long, sh as worksheet



"J.W. Aldridge" wrote:
>
> Thanx Tom.
> However, getting error on the following:
>
> Dim va s Variant, i as Long, sh as worksheet


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      6th Oct 2006
Dim v as Variant, i as Long, sh as worksheet

--
Regards,
Tom Ogilvy


"J.W. Aldridge" wrote:

>
> Thanx Tom.
> However, getting error on the following:
>
> Dim va s Variant, i as Long, sh as worksheet
>
>

 
Reply With Quote
 
J.W. Aldridge
Guest
Posts: n/a
 
      6th Oct 2006
Worked great.
Thanx.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
create a master list from other sheets ADK Microsoft Excel Worksheet Functions 0 17th Apr 2007 08:05 PM
copy data from numerous sheets to a master sheet lwleedy@tampabay.rr.com Microsoft Excel Discussion 1 6th Oct 2006 08:58 PM
Create New WB with copy of Sheets 1 & 2 when sheets count reaches 100 Corey Microsoft Excel Programming 5 26th Jun 2006 04:52 AM
How do I create a set of sheets that will update from a master? =?Utf-8?B?ZnVua3lfZnVua3lfYWxtb25kcw==?= Microsoft Excel Misc 2 13th Sep 2005 03:59 PM
Can you create master sheets within excel MICHAEL WYBORN Microsoft Excel Misc 3 17th Jul 2003 11:38 PM


Features
 

Advertising
 

Newsgroups
 


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