ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro Help (https://www.excelbanter.com/excel-worksheet-functions/20881-macro-help.html)

DME

Macro Help
 
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.



Ken Hudson

Hi,
Trying to visulaize your workbook....
In the monthly worksheet in cell C11 you have a total of cells O5 and O24
from Day1. In C12 you want to put the total of O5 and O24 from day day two
whne you run the macro.

If so, this code should work.

Option Explicit
Sub InsertTotal()
Dim CountRows As Integer
Worksheets("Monthly").Activate
CountRows = Range("C65536").End(xlUp).Row
Cells(CountRows + 1, 3) = Sheets("Daily Sheet").Range("O5") + Sheets("Daily
Sheet").Range("O24")
Worksheets("Daily Sheet").Activate
End Sub


"DME" wrote:

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.





All times are GMT +1. The time now is 01:34 PM.

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