I need visual basic code help!!!
Situation:
I have to run a report everyday where the numbers in column "G" need to be totalled. I want to write a macro to do this. The problem is that the number of rows in column "G" are different everyday.
Goal:
I would like to have the macro act like the Autosum button in excel, totalling the numbers, in however many rows are in column "G", and displaying the answer in the cell beneath the last row in column "G".
Code I tried:
This code got me the answer to display in a Message Box, but I need it to appear on the spreadsheet, in the cell beneath the last row in column "G".
answer = Application.WorksheetFunction.Sum(Range("G1", Range("G1").End(xlDown)))
MsgBox answer
Anyone please help me!!!!
sgn75
Situation:
I have to run a report everyday where the numbers in column "G" need to be totalled. I want to write a macro to do this. The problem is that the number of rows in column "G" are different everyday.
Goal:
I would like to have the macro act like the Autosum button in excel, totalling the numbers, in however many rows are in column "G", and displaying the answer in the cell beneath the last row in column "G".
Code I tried:
This code got me the answer to display in a Message Box, but I need it to appear on the spreadsheet, in the cell beneath the last row in column "G".
answer = Application.WorksheetFunction.Sum(Range("G1", Range("G1").End(xlDown)))
MsgBox answer
Anyone please help me!!!!
sgn75