Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Get multiple cells from all worksheets Code Not Work

I just would like to get multiple cells from all the worksheets and have them
placed in one summary worksheet but this code stops at pdp = ("N50")????


Sub GetCellFromWrksheets()
Dim wsNew As Worksheet, wsTemp As Worksheet
Dim r As Range
Dim pdp As Range
Dim pmm As Range
Set wsNew = Sheets.Add ' add a new worksheet
wsNew.Name = "All_Sheets" ' named "All_Sheets"
Set r = wsNew.Range("D1") ' cell to place the name in
For Each ws In ActiveWorkbook.Sheets 'loop through all worksheets
r = ws.Name ' put the name of the worksheet in the new sheet

pdp = Range("N50")
pmm = Range("M50")

'
'QteNum = Range("B6")
Set r = r.Offset(1, 0) ' move down one cell
ActiveCell.Offset(0, 1) = pdp
ActiveCell.Offset(0, 2) = pmm
Next ws
' clean up
Set ws = Nothing
Set r = Nothing
Set wsNew = Nothing
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Get multiple cells from all worksheets Code Not Work

Change your code to:

set pdp = Range("N50")
set pmm = Range("M50")

hth,

Doug

"Rookie_User" wrote in message
...
I just would like to get multiple cells from all the worksheets and have
them
placed in one summary worksheet but this code stops at pdp = ("N50")????


Sub GetCellFromWrksheets()
Dim wsNew As Worksheet, wsTemp As Worksheet
Dim r As Range
Dim pdp As Range
Dim pmm As Range
Set wsNew = Sheets.Add ' add a new worksheet
wsNew.Name = "All_Sheets" ' named "All_Sheets"
Set r = wsNew.Range("D1") ' cell to place the name in
For Each ws In ActiveWorkbook.Sheets 'loop through all worksheets
r = ws.Name ' put the name of the worksheet in the new sheet

pdp = Range("N50")
pmm = Range("M50")

'
'QteNum = Range("B6")
Set r = r.Offset(1, 0) ' move down one cell
ActiveCell.Offset(0, 1) = pdp
ActiveCell.Offset(0, 2) = pmm
Next ws
' clean up
Set ws = Nothing
Set r = Nothing
Set wsNew = Nothing
End Sub



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
Does SUMIF work over multiple worksheets? luttona Excel Discussion (Misc queries) 18 March 19th 10 08:07 PM
Delete Blank Rows Code - Multiple Worksheets - Multiple Documents BenS Excel Discussion (Misc queries) 3 June 29th 07 12:20 AM
How do I print multiple worksheets of a work book onto one page? Kab10 Excel Discussion (Misc queries) 2 May 23rd 06 09:56 AM
change code to work over multiple sheets cda_cmd Excel Programming 2 February 15th 06 01:05 AM
Add VBA code to multiple WorkSheets Al Excel Programming 0 May 24th 05 04:40 PM


All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"