|
-
Oct 7th, 2009, 04:54 PM
#1
Thread Starter
New Member
[RESOLVED] Creating index sheet with copied cells
I have a spreadsheet with 50 worksheets all created from the same template. I want to create a front sheet that lists the names of the worksheets in column A and then in column B copy the data from G10 and then in column C copy the data from H10 from each of the worksheets.
Currently I create a new worksheet and then use the following code:
Code:
Sub Sheetlister()
Dim Sheet As Object
Range("A2").Select
For Each Sheet In ActiveWorkbook.Sheets
ActiveCell.Formula = Sheet.Name
ActiveCell.Offset(1, 0).Select
Next Sheet
End sub
Can you help with adapting the code so that I can copy my data cells from each named sheet to the this sheet.
Thank you
-
Oct 7th, 2009, 05:25 PM
#2
Re: Creating index sheet with copied cells
Welcome to the forums 
something like this?
vb Code:
Sub PopulateData() Dim i As Long, shtName As String, rowNo As Long '~~> Replace "Sheet1" below with the name of the sheet '~~> where you want to display data shtName = "Sheet1" '~~> Row number from where you want to start putting data rowNo = 1 '~~> Loop thru the sheets in the workbook For i = 1 To Sheets.Count '~~> Checking if current sheet is not "Sheet1" If Sheets(i).Name <> shtName Then '~~> Get relevant values Sheets(shtName).Range("A" & rowNo).Value = Sheets(i).Name Sheets(shtName).Range("B" & rowNo).Value = Sheets(i).Range("G10").Value Sheets(shtName).Range("C" & rowNo).Value = Sheets(i).Range("H10").Value '~~> Increment row count rowNo = rowNo + 1 End If Next i End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 8th, 2009, 01:42 AM
#3
Thread Starter
New Member
Re: Creating index sheet with copied cells
What a way to welcome me - a brilliant wave and a solution!!!!!!!
Thank you so much, I had posted this on another forum and didn't get an answer that worked and I struggled to understand their code and I can work my way through yours and can now see how to adapt it for another worksheet I needed to do.
Thanks again
-
Oct 8th, 2009, 02:16 AM
#4
Re: Creating index sheet with copied cells
What a way to welcome me - a brilliant wave and a solution!!!!!!!
You are welcome 
I had posted this on another forum and didn't get an answer that worked and I struggled to understand their code
That is why VB Forums is the best 
Well, if your query is solved then do remember to mark this thread resolved. Check the link in my signature on how to mark a thread resolved
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 8th, 2009, 01:15 PM
#5
Thread Starter
New Member
Re: Creating index sheet with copied cells
I had already - did you see the green tick, but I put it against my bit and not the thread sorry (Thinking I thought I had got it right, but I didn't!!)
-
Oct 8th, 2009, 01:18 PM
#6
Re: [RESOLVED] Creating index sheet with copied cells
That's Ok
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|