S
SU123
Hi
I have been looking at the various answers already suggested but havent
quite got the answer I need.
I have a workbook with a multiple sheet and a totals sheet.
When i add a line to the individual sheet i need to also add it to the total
sheet. I have created a macro to do this, but it is using absolute values
instead of relative ones. How can i change this - a cut down version of the
macro is enlosed -
---- finds where i need to insert the row and want to insert above this---
Cells.Find(What:="TOTAL F", After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Rows("21:21").Select
Selection.Insert Shift:=xlDown
--- issue here is the absolute cell reference ----
Range("Q20").Select
Selection.Copy
Range("Q21").Select
ActiveSheet.Paste
Range("B21").Select
Sheets("Totals").Select
Application.CutCopyMode = False
ActiveSheet.Unprotect
---- finds where i can add the line to the 'Totals' sheet----
Cells.Find(What:="TOTAL F", After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
--- again goes to absolute cell ----
Range("A18").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A19").Select
Application.CutCopyMode = False
Selection.EntireRow.Insert
Range("C18:H18").Select
Selection.AutoFill Destination:=Range("C18:H19"), Type:=xlFillDefault
Range("C18:H19").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "='Aug 08 - Oct 08'!R[2]C[1]"
Range("A19").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Aug 08 - Oct 08").Select
End Sub
Hope this is clear and thanx in advance
SU
I have been looking at the various answers already suggested but havent
quite got the answer I need.
I have a workbook with a multiple sheet and a totals sheet.
When i add a line to the individual sheet i need to also add it to the total
sheet. I have created a macro to do this, but it is using absolute values
instead of relative ones. How can i change this - a cut down version of the
macro is enlosed -
---- finds where i need to insert the row and want to insert above this---
Cells.Find(What:="TOTAL F", After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Rows("21:21").Select
Selection.Insert Shift:=xlDown
--- issue here is the absolute cell reference ----
Range("Q20").Select
Selection.Copy
Range("Q21").Select
ActiveSheet.Paste
Range("B21").Select
Sheets("Totals").Select
Application.CutCopyMode = False
ActiveSheet.Unprotect
---- finds where i can add the line to the 'Totals' sheet----
Cells.Find(What:="TOTAL F", After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
--- again goes to absolute cell ----
Range("A18").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A19").Select
Application.CutCopyMode = False
Selection.EntireRow.Insert
Range("C18:H18").Select
Selection.AutoFill Destination:=Range("C18:H19"), Type:=xlFillDefault
Range("C18:H19").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "='Aug 08 - Oct 08'!R[2]C[1]"
Range("A19").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Aug 08 - Oct 08").Select
End Sub
Hope this is clear and thanx in advance
SU