Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro needs to reference cell values in different worksheets

How to I program a macro to add two numbers from a different worksheet (in
the same workbook) and store the result in the current worksheet? I already
tried,

Cells(5, y).Value = Sheets("Summary").Cells(4, 2).Value +
Sheets("Summary").Cells(5, 2).Value

This is preceeded by a loop (also not working because of the worksheet
reference) that looks across row 4 for a matching date so that it can put the
daily data into the historical worksheet. This loop is controlled by:

Do Until Cells(4, y).Value = Sheets("Summary").Cells(2, 3).Value

I think the problem is in trying to reference the other sheet. If it was
just a formula, I would use Summary!Cells(2,3) but that doesn't work in a
macro either.

I'm using Excel 2003. Thanks for your assistance.
Jim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default macro needs to reference cell values in different worksheets

Use the Worksheets object rather than the Sheets object:

Cells(5,y) = Worksheets("Summary").Cells(4, 2) +
Worksheets("Summary").Cells(5, 2)



"Capt Jim Cook" wrote in message
...
How to I program a macro to add two numbers from a different worksheet (in
the same workbook) and store the result in the current worksheet? I
already
tried,

Cells(5, y).Value = Sheets("Summary").Cells(4, 2).Value +
Sheets("Summary").Cells(5, 2).Value

This is preceeded by a loop (also not working because of the worksheet
reference) that looks across row 4 for a matching date so that it can put
the
daily data into the historical worksheet. This loop is controlled by:

Do Until Cells(4, y).Value = Sheets("Summary").Cells(2, 3).Value

I think the problem is in trying to reference the other sheet. If it was
just a formula, I would use Summary!Cells(2,3) but that doesn't work in a
macro either.

I'm using Excel 2003. Thanks for your assistance.
Jim



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
Cell reference between worksheets Cassie Rodgers Excel Discussion (Misc queries) 4 October 23rd 09 07:45 PM
Macro to Create Worksheets Based on Cell Values Lilbit Excel Worksheet Functions 3 March 24th 08 05:39 PM
How do I reference the same cell, but in different worksheets? marcon Excel Worksheet Functions 10 November 3rd 06 12:36 AM
Cell reference between worksheets jitu_tikili Excel Worksheet Functions 1 April 4th 06 07:54 PM
How do I reference values from 200 worksheets onto a summary sheet mac849 Excel Discussion (Misc queries) 4 March 17th 05 09:26 AM


All times are GMT +1. The time now is 05:53 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"