Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy and paste same cell from a number of sheets into a new sheet

Hi there,

I have a number of worksheets that all have the same layout. I would like to be able to extract or copy the same cell from every worksheet in the workbook and create a new worksheet containing the data. Is possible to write a macro for this?

For example, if cell B3 on every worksheet has customer DOB in it and I have 24 worksheets, I would like to extract B3 from all worksheets and create a new worksheet containing the data. So the new worksheet would have 24 DOB's in it and nothing else.

Any help appreciated,

Olly


Submitted via EggHeadCafe - Software Developer Portal of Choice
Treeview Explorer / Dialog for SmartPhone
http://www.eggheadcafe.com/tutorials...er--dialo.aspx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Copy and paste same cell from a number of sheets into a new sheet

Hi

Look at this:

Sub CopyDOB()
Dim newSh As Worksheet
Dim DestCell As Range
Set newSh = Worksheets.Add(After:=Worksheets(Worksheets.Count) )
Set DestCell = newSh.Range("A2")
For Each sh In ThisWorkbook.Worksheets
If sh.Name < newSh.Name Then
DestCell = sh.Range("B3").Value
Set DestCell = DestCell.Offset(1, 0)
End If
Next
End Sub

Regards,
Per

"Oliver Burdekin" skrev i meddelelsen
...
Hi there,

I have a number of worksheets that all have the same layout. I would like
to be able to extract or copy the same cell from every worksheet in the
workbook and create a new worksheet containing the data. Is possible to
write a macro for this?

For example, if cell B3 on every worksheet has customer DOB in it and I
have 24 worksheets, I would like to extract B3 from all worksheets and
create a new worksheet containing the data. So the new worksheet would
have 24 DOB's in it and nothing else.

Any help appreciated,

Olly


Submitted via EggHeadCafe - Software Developer Portal of Choice
Treeview Explorer / Dialog for SmartPhone
http://www.eggheadcafe.com/tutorials...er--dialo.aspx


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Copy and paste same cell from a number of sheets into a new sheet

Sub Summary_Sheet()
Dim WS As Worksheet
Worksheets.Add.Name = "Summary"
For i = 2 To Worksheets.Count
Set WS = Worksheets(i)
Cells(i - 1, 1).Value = WS.Range("B3").Value
'Cells(i - 1, 2).Value = WS.Name
Next i
End Sub



Gord Dibben MS Excel MVP

On Fri, 08 Jan 2010 09:34:39 -0800, Oliver Burdekin wrote:

Hi there,

I have a number of worksheets that all have the same layout. I would like to be able to extract or copy the same cell from every worksheet in the workbook and create a new worksheet containing the data. Is possible to write a macro for this?

For example, if cell B3 on every worksheet has customer DOB in it and I have 24 worksheets, I would like to extract B3 from all worksheets and create a new worksheet containing the data. So the new worksheet would have 24 DOB's in it and nothing else.

Any help appreciated,

Olly


Submitted via EggHeadCafe - Software Developer Portal of Choice
Treeview Explorer / Dialog for SmartPhone
http://www.eggheadcafe.com/tutorials...er--dialo.aspx


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Copy and paste same cell from a number of sheets into a new sheet

This code will get the value of B3 on each of your worksheets in the workbook
and put them into a new worksheet starting with A1. Hope this helps! If so,
let me know, click "YES" below.

Sub GetData()

Dim lngWks As Long
Dim i As Long

' get number of worksheets
lngWks = Worksheets.Count

' add a new worksheet
Worksheets.Add After:=Sheets(lngWks)

' add worksheet values to new worksheet
For i = 1 To lngWks
ActiveSheet.Cells(i, "A").Value = Sheets(i).Range("B3").Value
Next i

End Sub
--
Cheers,
Ryan


"Oliver Burdekin" wrote:

Hi there,

I have a number of worksheets that all have the same layout. I would like to be able to extract or copy the same cell from every worksheet in the workbook and create a new worksheet containing the data. Is possible to write a macro for this?

For example, if cell B3 on every worksheet has customer DOB in it and I have 24 worksheets, I would like to extract B3 from all worksheets and create a new worksheet containing the data. So the new worksheet would have 24 DOB's in it and nothing else.

Any help appreciated,

Olly


Submitted via EggHeadCafe - Software Developer Portal of Choice
Treeview Explorer / Dialog for SmartPhone
http://www.eggheadcafe.com/tutorials...er--dialo.aspx
.

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
Loop thru sheets copy and then paste in other sheet LuisE Excel Programming 2 August 7th 08 07:28 PM
Active Cell Copy And Paste Sheet to Sheet A.R.J Allan Jefferys New Users to Excel 4 May 4th 06 02:04 AM
copy from one sheet and paste into other sheets TUNGANA KURMA RAJU Excel Discussion (Misc queries) 3 December 8th 05 02:49 PM
Copy paste WkBk/sheet 1 to multiple wkbks/sheets wrpalmer Excel Programming 1 August 20th 05 03:08 PM
copy and paste from different sheets into one sheet using a VB code reena Excel Programming 2 August 5th 03 02:49 PM


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