Forum Home
Press F1
 
Thread ID: 99296 2009-04-26 16:30:00 Excel Macro Help fisheyes31 (14860) Press F1
Post ID Timestamp Content User
768701 2009-04-26 16:30:00 I have a worksheet that I want to daily move the results of formulas to another sheet (sheet 2) to have a running total. Can do the formulas but getting the macro to work has been above my ability. The macro I have used is:
Keyboard Shortcut: Ctrl+a
'
Range("F13").Select
Selection.Copy
Sheets("Sheet2").Select
Range("B119").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet1").Select
Range("F10").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Range("C119").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet1").Select
Range("F11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Range("D119").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet1").Select
Range("F12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Range("E119").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
If ActiveCell.Row < 65536 Then
ActiveCell.Offset(1, 0).Select
iCP = ActiveCell.Column
ActiveCell.EntireRow.Select
ActiveCell.Offset(0, iCP - 1).Activate
End If
End Sub
This seems to get the data transfered and moved down one row but when I try to run it for the next day it will just rewrite the data the same place and not move down the next row. I know very little about macros so if anyone has an explaination of what needs to be done please make it very simple.

Thanks
fisheyes31 (14860)
768702 2009-04-26 17:55:00 This is how I'd do it

Name your next cells to be copied to in sheet 2 Target1, Target2, Target3 etc

Then place this code into your macro for each of your copies replacing the source cell and Targetn with the appropriate values

Range("F13").Select
Selection.Copy
Sheets("Sheet2").Select
Range("Target1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(1, 0).Select
ActiveCell.Name = "Target1"



What this does is copy the cell to the destination sheet and then set up the next row to be copied to next time

Trev
TeejayR (4271)
1