Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DME DME is offline
external usenet poster
 
Posts: 4
Default Macro to copy cells from another sheet

I have a sheet that is updated on a daily basis, a template of sorts. Each
day the user inputs the prior days information into the "Daily Sheet". I
then have to manually go into my "Monthly" total spreadsheet and input the
numbers from the daily sheet. Thus producing a Month To Date total.

Now I am sure there is a better way to update my "Monthly" spreadsheet
without manually inputting them each day. I have tried setting up a Command
Button that activates a macro that would go to the Daily spreadsheet and
grab the numbers I need to have. The numbers in the "Daily" sheet are the
same cells everytime. For instance Cells O5 AND O24 in thh Daily Supply
spreadsheet. Here is my problem. I have the following code:

ActiveCell.FormulaR1C1 = "='Daily Supply'!R[-6]C[12]+'Daily
Supply'!R[13]C[12]"
ActiveCell.Offset(1, 0).Range("A1").Select

I created this Macro from cell C11 in the "Monthly" spreadsheet. It works
fine in that cell, but when I run it from cell C12, it pulls the information
from Cell O6 and O25 in the "Daily" Spreadsheet. I have tried relative
reference when recording the Macro and have tried it without and neither one
seems to work for me.

Can someone please tell me what I am doing wrong?

Or if there is an easier way to perform the task I am trying to accomplish
using another means besides a Macro and command button.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Macro to copy cells from another sheet

DME,

The R[-6] means that the affected cell is 6 rows above the
active cell. So when you run it from row 11 you get row 5.
When you run it from row 12 you get row 6.
Change -6 to -7 and try it.

Jim Cone
San Francisco, USA



"DME" <craigjoseathotmaildotcom wrote in message
...
I have a sheet that is updated on a daily basis, a template of sorts. Each
day the user inputs the prior days information into the "Daily Sheet". I
then have to manually go into my "Monthly" total spreadsheet and input the
numbers from the daily sheet. Thus producing a Month To Date total.

Now I am sure there is a better way to update my "Monthly" spreadsheet
without manually inputting them each day. I have tried setting up a Command
Button that activates a macro that would go to the Daily spreadsheet and
grab the numbers I need to have. The numbers in the "Daily" sheet are the
same cells everytime. For instance Cells O5 AND O24 in thh Daily Supply
spreadsheet. Here is my problem. I have the following code:

ActiveCell.FormulaR1C1 = "='Daily Supply'!R[-6]C[12]+'Daily
Supply'!R[13]C[12]"
ActiveCell.Offset(1, 0).Range("A1").Select

I created this Macro from cell C11 in the "Monthly" spreadsheet. It works
fine in that cell, but when I run it from cell C12, it pulls the information
from Cell O6 and O25 in the "Daily" Spreadsheet. I have tried relative
reference when recording the Macro and have tried it without and neither one
seems to work for me.

Can someone please tell me what I am doing wrong?

Or if there is an easier way to perform the task I am trying to accomplish
using another means besides a Macro and command button.


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
Macro-Copy various cells in sheet1 into next available row in sheet 2 lunker55 Excel Discussion (Misc queries) 7 October 21st 05 11:05 PM
Use macro to check a range of cells within a row and copy wanted data to new sheet busspeed Excel Programming 2 September 29th 04 02:55 PM
using a macro to copy cells from one sheet to another Tony Excel Programming 2 August 23rd 04 03:30 AM
Need Macro to Copy Visible Cells to New Sheet Tom Ogilvy Excel Programming 0 July 15th 03 04:05 PM
Need Macro to Copy Visible Cells to New Sheet Don Guillett[_4_] Excel Programming 0 July 15th 03 03:56 PM


All times are GMT +1. The time now is 07:47 PM.

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"