Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Les
Try http://www.rondebruin.nl/copy2.htm But you can also create a link to each sheet http://www.rondebruin.nl/summary.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Les" wrote in message ... Can anyone help please. I have a workbook that contains 1000+ worksheets believe it or not. Not sure why or how it was done like that, but there it is. I need a macro to copy the cell A1 from each sheet (it has the page title in it) into a new sheet giving me a list of page titles. Regards Les. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Les
Test this one Sub Test1() Dim sh As Worksheet Dim DestSh As Worksheet Dim Last As Long On Error Resume Next If Len(ThisWorkbook.Worksheets.Item("Master").Name) = 0 Then On Error GoTo 0 Application.ScreenUpdating = False Set DestSh = ThisWorkbook.Worksheets.Add DestSh.Name = "Master" For Each sh In ThisWorkbook.Worksheets If sh.Name < DestSh.Name Then Last = LastRow(DestSh) sh.Range("A1").Copy With DestSh.Cells(Last + 1, "B") .PasteSpecial xlPasteValues, , False, False .PasteSpecial xlPasteFormats, , False, False Application.CutCopyMode = False End With DestSh.Cells(Last + 1, "A").Value = sh.Name 'This will copy the sheet name in the A column if you want End If Next DestSh.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 "Les" wrote in message ... Hi Ron Sorry I couldn't get the code to work for what I wanted it to do, probably down to my inexperience. I'm sure it's quite straightforward, I just need to copy the value of cell A1 from each worksheet to compile a list in a new worksheet. I would do it manually but there are more than 1000 worksheets. "Ron de Bruin" wrote: Hi Les Try http://www.rondebruin.nl/copy2.htm But you can also create a link to each sheet http://www.rondebruin.nl/summary.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Les" wrote in message ... Can anyone help please. I have a workbook that contains 1000+ worksheets believe it or not. Not sure why or how it was done like that, but there it is. I need a macro to copy the cell A1 from each sheet (it has the page title in it) into a new sheet giving me a list of page titles. Regards Les. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy rows from one Data sheet to another sheet based on cell conte | Excel Discussion (Misc queries) | |||
copy name from active sheet to cell - using macro or function | Excel Worksheet Functions | |||
how to copy a cell with formula from sheet 1 (data is all vertical) into sheet 2 | Excel Worksheet Functions | |||
Copy text from same cell on every sheet to title sheet? | Excel Discussion (Misc queries) | |||
How to create a Macro to Copy Information in one sheet to another sheet. | Excel Programming |