ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combine data on one sheet (https://www.excelbanter.com/excel-programming/349189-combine-data-one-sheet.html)

dogpigfish

Combine data on one sheet
 
I have multiple sheets that contain data. I want to create a summary page
that holds all the data on every tab into one newly generated sheet. For
Example:

On one sheet "C22" = 1 and is set to "C44" = China
On the next sheet "C22" = 3 and is set to "C44" = Japan

The newly generated sheet would present:
C1 = 1, D1 = China
C2 = 3, D2 = Japan

I have some ideas, but a macro set to a button would be best. What code
could I use?

Tom Ogilvy

Combine data on one sheet
 
Sub Summarize()
Dim i as Long, sh as Worksheet
Dim sh1 as Worksheet
i = 0
set sh1 = Worksheets("Summary")
for each sh in Activeworkbook.Worksheets
if sh.Name < sh1.Name then
i = i + 1
sh1.cells(i,3).Value = sh.Range("C22").Value
sh1.Cells(i,4).Value = sh.Range("C44").Value
end if
Next
End Sub
--
Regards,
Tom Ogilvy

"dogpigfish" wrote in message
...
I have multiple sheets that contain data. I want to create a summary page
that holds all the data on every tab into one newly generated sheet. For
Example:

On one sheet "C22" = 1 and is set to "C44" = China
On the next sheet "C22" = 3 and is set to "C44" = Japan

The newly generated sheet would present:
C1 = 1, D1 = China
C2 = 3, D2 = Japan

I have some ideas, but a macro set to a button would be best. What code
could I use?




dogpigfish

Combine data on one sheet
 
Works great. I was overcomplicating it. I am entry level for coding in
excel.

"Tom Ogilvy" wrote:

Sub Summarize()
Dim i as Long, sh as Worksheet
Dim sh1 as Worksheet
i = 0
set sh1 = Worksheets("Summary")
for each sh in Activeworkbook.Worksheets
if sh.Name < sh1.Name then
i = i + 1
sh1.cells(i,3).Value = sh.Range("C22").Value
sh1.Cells(i,4).Value = sh.Range("C44").Value
end if
Next
End Sub
--
Regards,
Tom Ogilvy

"dogpigfish" wrote in message
...
I have multiple sheets that contain data. I want to create a summary page
that holds all the data on every tab into one newly generated sheet. For
Example:

On one sheet "C22" = 1 and is set to "C44" = China
On the next sheet "C22" = 3 and is set to "C44" = Japan

The newly generated sheet would present:
C1 = 1, D1 = China
C2 = 3, D2 = Japan

I have some ideas, but a macro set to a button would be best. What code
could I use?






All times are GMT +1. The time now is 04:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com