Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default combination data from Multiple Worksheets into 1 Worksheet

Hi experts,

I have 40 sheets with same template which have A:H columns in a file
where col A is country,Col B is city and H is the population. Each
sheet named by the country. The data will be updated weekly. If I want
to find which city's population is greater than 10,000, how can I
extract the result into a new sheet so that it can be updated weeking
automatically?


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default combination data from Multiple Worksheets into 1 Worksheet

Assume the results are placed in a worksheet named summary in the same
workbook.
Sub CopyData()
Dim rng as Range, cell as Range, cell1 as Range
Dim sh as Worksheet
Worksheets("Summary").UsedRange.EntireRow.delete
for each sh in ThisWorkbook.Worksheets
if lCase(sh.Name) < "summary" then
set rng = sh.Range(sh.Cells(1,1),sh.Cells(1,1).End(xldown))
for each cell in rng
if cell.offset(0,7).Value 10000 then
set cell1 = worksheets("Summary") _
.Cells(rows.count,1).End(xlup)(2)
cell.Entirerow.copy Destination:=Cell1
end if
Next
End if
Next
End Sub

Code is untested an may contain typos.

--
Regards,
Tom Ogilvy


"keldo " wrote in message
...
Hi experts,

I have 40 sheets with same template which have A:H columns in a file
where col A is country,Col B is city and H is the population. Each
sheet named by the country. The data will be updated weekly. If I want
to find which city's population is greater than 10,000, how can I
extract the result into a new sheet so that it can be updated weeking
automatically?


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default combination data from Multiple Worksheets into 1 Worksheet

Ogilvy, It does work!!1 Thanks a lot. In advance, the country name i
cell A1 inside each sheet. and start from row 2, col A is city and co
H is population, in this time, I just want country, city and populatio
list in 'summary', how to modify the program

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default combination data from Multiple Worksheets into 1 Worksheet

Sub CopyData()
Dim rng as Range, cell as Range, cell1 as Range
Dim sh as Worksheet
Worksheets("Summary").UsedRange.EntireRow.delete
for each sh in ThisWorkbook.Worksheets
if lCase(sh.Name) < "summary" then
set rng = sh.Range(sh.Cells(2,1),sh.Cells(2,1).End(xldown))
for each cell in rng
if cell.offset(0,7).Value 10000 then
set cell1 = worksheets("Summary") _
.Cells(rows.count,1).End(xlup)(2)
sh.Range("A1").copy Destination:=Cell1
cell.copy Destination:=Cell1.Offset(0,1)
cell.offset(0,7).Copy Destination:=cell.offset(0,2)
end if
Next
End if
Next
End Sub

--
Regards,
Tom Ogilvy


"keldo " wrote in message
...
Ogilvy, It does work!!1 Thanks a lot. In advance, the country name in
cell A1 inside each sheet. and start from row 2, col A is city and col
H is population, in this time, I just want country, city and population
list in 'summary', how to modify the program?


---
Message posted from http://www.ExcelForum.com/



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 data from multiple worksheets into master worksheet Jill Excel Worksheet Functions 1 February 3rd 09 11:29 PM
how to copy data from one worksheet to multiple worksheets at once zeb Excel Worksheet Functions 2 October 21st 08 07:25 PM
Move sorted data from one worksheet to multiple worksheets? Mark Excel Worksheet Functions 1 October 4th 07 09:32 AM
Compiling data from multiple worksheets into one worksheet thelonious419 Excel Discussion (Misc queries) 1 April 24th 06 06:16 PM
Data from One Worksheet split into Multiple Worksheets DougJoe Excel Programming 2 January 19th 04 08:06 PM


All times are GMT +1. The time now is 04:18 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"