Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
merging worksheets | Excel Discussion (Misc queries) | |||
Merging worksheets together | Excel Discussion (Misc queries) | |||
merging worksheets | Excel Discussion (Misc queries) | |||
Merging Worksheets | Excel Discussion (Misc queries) | |||
Merging of Worksheets | Excel Discussion (Misc queries) |