Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to copy a multiple range of cells and recalculate the values with the
new constants. I got solved the copy part with some help, but now i can't get the paste arguments right. Here's the code Sub CopyAndPasteV2() For Each sht In Sheets Select Case sht.Name Case "D": SourceRow = -1 Case "A": SourceRow = 5 Case "B": SourceRow = 6 Case Else: SourceRow = 0 End Select If SourceRow 0 Then sht.Range("a6").EntireRow.Insert Worksheets("INTRADAY").Rows(SourceRow).Copy sht.Rows(6).PasteSpecial xlValues sht.Range("C7:D7,J7:M7,P7:T7").Copy sht.Range("C6:D6,J6:M6,P6:T6").xlPasteAll End If If SourceRow = -1 Then sht.Range("a6").EntireRow.Insert End If Next sht End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This should work:
Sub CopyAndPasteV2() For Each sht In Sheets Select Case sht.Name Case "D": SourceRow = -1 Case "A": SourceRow = 5 Case "B": SourceRow = 6 Case Else: SourceRow = 0 End Select If SourceRow 0 Then sht.Range("a6").EntireRow.Insert Worksheets("INTRADAY").Rows(SourceRow).Copy sht.Rows(6).PasteSpecial xlValues sht.Range("C7:D7").Copy sht.Range("C6") sht.Range("J7:M7").Copy sht.Range("J6") sht.Range("P7:T7").Copy sht.Range("P6") End If If SourceRow = -1 Then sht.Range("a6").EntireRow.Insert End If Next sht End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
WORKS LIKE A CHARM
"TomPl" wrote: This should work: Sub CopyAndPasteV2() For Each sht In Sheets Select Case sht.Name Case "D": SourceRow = -1 Case "A": SourceRow = 5 Case "B": SourceRow = 6 Case Else: SourceRow = 0 End Select If SourceRow 0 Then sht.Range("a6").EntireRow.Insert Worksheets("INTRADAY").Rows(SourceRow).Copy sht.Rows(6).PasteSpecial xlValues sht.Range("C7:D7").Copy sht.Range("C6") sht.Range("J7:M7").Copy sht.Range("J6") sht.Range("P7:T7").Copy sht.Range("P6") End If If SourceRow = -1 Then sht.Range("a6").EntireRow.Insert End If Next sht End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Simple Macro - I think... Copy - Paste on Click | Excel Discussion (Misc queries) | |||
Copy and paste over multiple sessions error | Excel Discussion (Misc queries) | |||
Very Simple Copy and Paste Sheet - Error | Excel Programming | |||
How to write a simple copy-paste macro? | New Users to Excel | |||
Macro newbie - simple copy/paste function | Excel Programming |