Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Combine non-contiguous data from multiple worksheets

I am using Excel 2002 and have a workbook with several sheets that I
need to combine into one list. The data I need to combine is located
on the same place on each sheet; however, one potential wrinkle is
that the data is non-contiguous (i.e. Name is cell B7, Salary is in
cell D10, etc.). This may be able to be done without using VBA;
however, the consolidate feature does not seem to produce what I want.

Any ideas?

Thanks,
Brent
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Combine non-contiguous data from multiple worksheets

Hi Brentus

Try this

Sub Test1()
Dim sh As Worksheet
Dim DestSh As Worksheet
Dim Last As Long
Dim smallrng As Range

On Error Resume Next
If Len(ThisWorkbook.Worksheets.Item("Master").Name) = 0 Then
On Error GoTo 0
Application.ScreenUpdating = False
Set DestSh = Worksheets.Add
DestSh.Name = "Master"
For Each sh In ThisWorkbook.Worksheets
If sh.Name < DestSh.Name Then
For Each smallrng In sh. _
Range("B7,D10").Areas
Last = LastRow(DestSh)
smallrng.Copy DestSh.Cells(Last + 1, "A")
Next
End If
Next
Cells(1).Select
Application.ScreenUpdating = True
Else
MsgBox "The sheet Master already exist"
End If
End Sub

Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Brentus" wrote in message m...
I am using Excel 2002 and have a workbook with several sheets that I
need to combine into one list. The data I need to combine is located
on the same place on each sheet; however, one potential wrinkle is
that the data is non-contiguous (i.e. Name is cell B7, Salary is in
cell D10, etc.). This may be able to be done without using VBA;
however, the consolidate feature does not seem to produce what I want.

Any ideas?

Thanks,
Brent



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
How do I combine data from multiple worksheets into one master lis KW Excel Worksheet Functions 3 September 1st 09 12:40 AM
combine columns of data from multiple worksheets into one Michael Excel Worksheet Functions 7 December 9th 08 11:44 PM
Combine Multiple Worksheets Havenstar Excel Discussion (Misc queries) 2 January 25th 08 08:49 PM
Combine multiple workbooks into 1 workbook w/ multiple worksheets buffgirl71 Excel Discussion (Misc queries) 1 May 13th 06 12:28 PM
Combine multiple workbooks into 1 workbook w/ multiple worksheets buffgirl71 Excel Discussion (Misc queries) 2 May 12th 06 10:30 PM


All times are GMT +1. The time now is 05:17 AM.

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

About Us

"It's about Microsoft Excel"