Collation of Sheet Names and Cell Details....

backfromthebush

New Member
Joined
Jul 2, 2010
Messages
37
Hi all,

I have a large Excel workbook with 400 or so sheets. Each sheet is titled by its product name. What I'm after is to be able to extract the title of each sheet (sheet name) AND the value in cell A3 of that sheet (which is the product code), and form a list from across the entire workbook.
Any ideas? :)
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hello backfromthebush,

This example macro will combine the each sheet name and the value of "A3" into a string. However, it lacks code to anything with the string since you made no mention of what to do with it.
Code:
Sub Macro1()

  Dim strName As String
  Dim Wks As Worksheet

    For Each Wks In Worksheets
      strName = Wks.Name & Wks.Range("A3")
      'Add code here to do something with the string
    Next Wks

End Sub
 
Upvote 0
Thanks mate... that information probably would be helpful!

With the string i'd like it to be put into a new sheet (lets name it "Product Codes"), and simply have column A with the codes and column B with the sheet names.
 
Upvote 0
Hello backfromthebush,

This will either create the worksheet "Product Codes" or use it if it already exists. The product codes will be added into column "A".
Code:
Sub Macro1a()

  Dim ProdWks As Worksheet
  Dim R As Long
  Dim strName As String
  Dim Wks As Worksheet

   'Add the sheet if needed or use the existing one.
    On Error Resume Next
      Set ProdWks = Worksheets("Product Codes")
      If Err > 0 Then
         Set ProdWks = Worksheets.Add(After:=Worksheets(Worksheets.Count))
         ActiveSheet.Name = "Product Codes"
         R = 1
      Else
         R = ProdWks.UsedRange.Rows.Count
      End If
    On Error GoTo 0
    
    
    For Each Wks In Worksheets
      If Wks.Name <> ProdWks.Name Then
         strName = Wks.Name & Wks.Range("A3")
         ProdWks.Range("A1").Offset(R, 0) = strName
         R = R + 1
      End If
    Next Wks

End Sub
Sincerely,
Leith Ross
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top