ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pull Cells From Sheets (https://www.excelbanter.com/excel-programming/340093-pull-cells-sheets.html)

Optitron[_9_]

Pull Cells From Sheets
 

I need to pull cell N2 from each of the 48 sheets in my workbook an
compile a list of them onto sheet1

--
Optitro
-----------------------------------------------------------------------
Optitron's Profile: http://www.excelforum.com/member.php...fo&userid=2672
View this thread: http://www.excelforum.com/showthread.php?threadid=46763


Bernie Deitrick

Pull Cells From Sheets
 
Optitron,

Try the macro below.

HTH,
Bernie
MS Excel MVP


Sub Macro1()
Dim i As Integer

With Worksheets("Sheet1")
..Cells(1, 1).Value = "Sheet Name"
..Cells(1, 2).Value = "Value from N2"
For i = 1 To Sheets.Count
..Cells(i + 1, 1).Value = Sheets(i).Name
..Cells(i + 1, 2).Value = Sheets(i).Range("N2").Value
Next i
End With
End Sub

"Optitron" wrote in
message ...

I need to pull cell N2 from each of the 48 sheets in my workbook and
compile a list of them onto sheet1.


--
Optitron
------------------------------------------------------------------------
Optitron's Profile:
http://www.excelforum.com/member.php...o&userid=26729
View this thread: http://www.excelforum.com/showthread...hreadid=467639




Optitron[_10_]

Pull Cells From Sheets
 

It worked. The lines that you put ..cells were red so I changed it to
..cells and it worked perfect.


--
Optitron
------------------------------------------------------------------------
Optitron's Profile: http://www.excelforum.com/member.php...o&userid=26729
View this thread: http://www.excelforum.com/showthread...hreadid=467639


Bernie Deitrick

Pull Cells From Sheets
 
Optitron,

I didn't put ..Cells - I put .Cells. (That is probably a result of your web interface.) Taking out
the single dot and using Cells means that the summary table will be placed on the active sheet,
rather than the sheet indicated by the With statement. If that is okay, then you don't need the With
statements. Also, you could also use a worksheet activate command to choose which sheet should be
active.

HTH,
Bernie
MS Excel MVP


"Optitron" wrote in message
...

It worked. The lines that you put ..cells were red so I changed it to
cells and it worked perfect.


--
Optitron
------------------------------------------------------------------------
Optitron's Profile: http://www.excelforum.com/member.php...o&userid=26729
View this thread: http://www.excelforum.com/showthread...hreadid=467639





All times are GMT +1. The time now is 02:43 PM.

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