LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default merging worksheets

Sub MergeTwoWorksheets()
Dim sh1 As Worksheet, sh2 As Worksheet
Dim sh3 As Worksheet, rng1 As Range
Dim rng2 As Range
Set sh1 = Worksheets(1)
Set sh2 = Worksheets(2)
Set sh3 = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
Set rng1 = sh1.Range("A1").CurrentRegion
Set rng2 = sh2.Range("A1").CurrentRegion
rng1.Copy sh3.Range("A1")
rng2.Copy sh3.Range("A1").Offset( _
rng1.Rows.Count, 0)
End Sub


if you don't have blank rows in your data.

If you meant worksheets in separate workbooks rather than two worksheets in
the same workbook, then that would require some modifications.

--
Regards,
Tom Ogilvy


wrote in message
ps.com...
Hi, while this has been brought up many times, I'm still having
difficulty finding a macro or some short cut that works well to merge
two worksheets into one. I want to be able to merge them easily and in
such a way that it could be automatically updated when new data is
added to one or both of the original sheets. The sheets have the same
format-same headings and number of columns-so I would like to get
solely the data from the second sheet without the headings to add to
the first sheet, which would retain the headings. I'm new to VBA, so I
may be missing something obvious, but if I can be pointed in the right
direction, I would greatly appreciate it.

Thanks in advance.
~M



 
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
merging worksheets rsjmk Excel Discussion (Misc queries) 1 October 31st 07 07:43 PM
Merging worksheets together sschwickrath Excel Discussion (Misc queries) 1 September 30th 07 06:08 AM
merging worksheets thebaldsoprano Excel Discussion (Misc queries) 3 February 24th 07 11:25 PM
Merging Worksheets Michael Ryle Excel Discussion (Misc queries) 1 March 10th 06 05:30 AM
Merging of Worksheets David Smithz Excel Discussion (Misc queries) 1 March 6th 06 06:51 PM


All times are GMT +1. The time now is 04:31 AM.

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"