#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Macros

Hi I have written a Macro to take data from one worksheet
and paste it into another to keep a record as it were.
Unofrtunately though as it is pasting as a formula
everytime I change the data in the original sheet it
overwrites all the data in the new sheet. I would be
really grateful for any help anyone can give me on this as
it has stumped me. Listed below is the macro
Sub save()
'
' save Macro
' Macro recorded 23/04/2004 by matthewa
'

'
Sheets("Sheet2").Select
Dim MyText As String
Range("A2").Select
MyText = "=EUROLifestyle!R[18]C[1]"
ActiveCell.FormulaR1C1 = MyText
Range("B2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[20]C"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[17]C[1]"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[19]C[-1]"
Range("F2").Select
ActiveCell.FormulaR1C1 = _
"=IF(EUROLifestyle!R[20]C[-2]=""Yes"",""Accidental
Damage"",""Standard"")"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[22]C[-3]"
Range("H2").Select
ActiveCell.FormulaR1C1 = _
"=IF(EUROLifestyle!R[23]C[-4]=""Yes"",""Accidental
Damgage"",""Standard"")"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[25]C[-5]"
ActiveWindow.SmallScroll ToRight:=5
Range("J2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[28]C[-6]"
Range("K2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[32]C[-7]"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[35]C[-8]"
Range("M2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[37]C[-9]"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[37]C[-10]"
ActiveWindow.SmallScroll ToRight:=3
Range("O2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[41]C[-11]"
Range("P2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[44]C[-12]"
Range("Q2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[33]C[-8]"
Rows("2:2").Select
Range("J2").Activate
Selection.Insert Shift:=xlDown
Range("J2").Select
Sheets("EUROLifestyle").Select
End Sub

I know its a bit backward!

Thanks loads in advance.

Matt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Macros

Your problem is not very clear.
suppose the data in your source worksheet is range
named "mydata", then yo want to copy the values to a NEW
worksheet...
Sub CopyData
DIM rSource as Range
DIM rTarget as Range
DIM WS_New as Worksheet

set rSource = Range("mydata")
' or
' Set rSource = Range("A5:G75") 'as an example

SET WS_New = Worksheets.Add

SET rTarget = WS_New.Range("A1")
with rTarget.Resize
(rSource.Rows.Count,rSource.Columns.Count)
..Value = rSource.Value
End With
End SUb

HTH
Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
Hi I have written a Macro to take data from one

worksheet
and paste it into another to keep a record as it were.
Unofrtunately though as it is pasting as a formula
everytime I change the data in the original sheet it
overwrites all the data in the new sheet. I would be
really grateful for any help anyone can give me on this

as
it has stumped me. Listed below is the macro
Sub save()
'
' save Macro
' Macro recorded 23/04/2004 by matthewa
'

'
Sheets("Sheet2").Select
Dim MyText As String
Range("A2").Select
MyText = "=EUROLifestyle!R[18]C[1]"
ActiveCell.FormulaR1C1 = MyText
Range("B2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[20]C"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[17]C[1]"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[19]C[-1]"
Range("F2").Select
ActiveCell.FormulaR1C1 = _
"=IF(EUROLifestyle!R[20]C[-2]

=""Yes"",""Accidental
Damage"",""Standard"")"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[22]C[-3]"
Range("H2").Select
ActiveCell.FormulaR1C1 = _
"=IF(EUROLifestyle!R[23]C[-4]

=""Yes"",""Accidental
Damgage"",""Standard"")"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[25]C[-5]"
ActiveWindow.SmallScroll ToRight:=5
Range("J2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[28]C[-6]"
Range("K2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[32]C[-7]"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[35]C[-8]"
Range("M2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[37]C[-9]"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[37]C[-10]"
ActiveWindow.SmallScroll ToRight:=3
Range("O2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[41]C[-11]"
Range("P2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[44]C[-12]"
Range("Q2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[33]C[-8]"
Rows("2:2").Select
Range("J2").Activate
Selection.Insert Shift:=xlDown
Range("J2").Select
Sheets("EUROLifestyle").Select
End Sub

I know its a bit backward!

Thanks loads in advance.

Matt
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
jim jim is offline
external usenet poster
 
Posts: 19
Default Macros

If all you want to do is copy the data from one sheet to
another why not just copy the whole sheet and paste select
values only into the other sheet. I.e

Sheets("Sheet1").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False


Where sheet1 is your original sheet



-----Original Message-----
Hi I have written a Macro to take data from one worksheet
and paste it into another to keep a record as it were.
Unofrtunately though as it is pasting as a formula
everytime I change the data in the original sheet it
overwrites all the data in the new sheet. I would be
really grateful for any help anyone can give me on this

as
it has stumped me. Listed below is the macro
Sub save()
'
' save Macro
' Macro recorded 23/04/2004 by matthewa
'

'
Sheets("Sheet2").Select
Dim MyText As String
Range("A2").Select
MyText = "=EUROLifestyle!R[18]C[1]"
ActiveCell.FormulaR1C1 = MyText
Range("B2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[20]C"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[17]C[1]"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[19]C[-1]"
Range("F2").Select
ActiveCell.FormulaR1C1 = _
"=IF(EUROLifestyle!R[20]C[-2]

=""Yes"",""Accidental
Damage"",""Standard"")"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[22]C[-3]"
Range("H2").Select
ActiveCell.FormulaR1C1 = _
"=IF(EUROLifestyle!R[23]C[-4]

=""Yes"",""Accidental
Damgage"",""Standard"")"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[25]C[-5]"
ActiveWindow.SmallScroll ToRight:=5
Range("J2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[28]C[-6]"
Range("K2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[32]C[-7]"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[35]C[-8]"
Range("M2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[37]C[-9]"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[37]C[-10]"
ActiveWindow.SmallScroll ToRight:=3
Range("O2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[41]C[-11]"
Range("P2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[44]C[-12]"
Range("Q2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[33]C[-8]"
Rows("2:2").Select
Range("J2").Activate
Selection.Insert Shift:=xlDown
Range("J2").Select
Sheets("EUROLifestyle").Select
End Sub

I know its a bit backward!

Thanks loads in advance.

Matt
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Macros

Have you tried pasting just the values:
Selection.Paste Paste:=xlValues
-----Original Message-----
Hi I have written a Macro to take data from one worksheet
and paste it into another to keep a record as it were.
Unofrtunately though as it is pasting as a formula
everytime I change the data in the original sheet it
overwrites all the data in the new sheet. I would be
really grateful for any help anyone can give me on this as
it has stumped me. Listed below is the macro
Sub save()
'
' save Macro
' Macro recorded 23/04/2004 by matthewa
'

'
Sheets("Sheet2").Select
Dim MyText As String
Range("A2").Select
MyText = "=EUROLifestyle!R[18]C[1]"
ActiveCell.FormulaR1C1 = MyText
Range("B2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[20]C"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[17]C[1]"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[19]C[-1]"
Range("F2").Select
ActiveCell.FormulaR1C1 = _
"=IF(EUROLifestyle!R[20]C[-2]=""Yes"",""Accidental
Damage"",""Standard"")"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[22]C[-3]"
Range("H2").Select
ActiveCell.FormulaR1C1 = _
"=IF(EUROLifestyle!R[23]C[-4]=""Yes"",""Accidental
Damgage"",""Standard"")"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[25]C[-5]"
ActiveWindow.SmallScroll ToRight:=5
Range("J2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[28]C[-6]"
Range("K2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[32]C[-7]"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[35]C[-8]"
Range("M2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[37]C[-9]"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[37]C[-10]"
ActiveWindow.SmallScroll ToRight:=3
Range("O2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[41]C[-11]"
Range("P2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[44]C[-12]"
Range("Q2").Select
ActiveCell.FormulaR1C1 = "=EUROLifestyle!R[33]C[-8]"
Rows("2:2").Select
Range("J2").Activate
Selection.Insert Shift:=xlDown
Range("J2").Select
Sheets("EUROLifestyle").Select
End Sub

I know its a bit backward!

Thanks loads in advance.

Matt
.

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
Macros warning always shows up, even if all macros removed Joe M Excel Discussion (Misc queries) 1 December 20th 07 04:45 AM
Making excel macros run Word macros Matthew McManus Excel Programming 1 February 18th 04 02:57 AM
Macro Size Limit / open macros with macros? andycharger[_7_] Excel Programming 6 February 13th 04 02:00 PM
Macros not appearing in the Tools Macro Macros list hglamy[_2_] Excel Programming 5 October 24th 03 09:10 AM
Suppress the Disable Macros / Enable Macros Dialog Shoji Karai Excel Programming 5 September 24th 03 03:10 AM


All times are GMT +1. The time now is 03:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"