Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default simple copy paste multiple range macro ARGUMENT ERROR

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 342
Default simple copy paste multiple range macro ARGUMENT ERROR

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default simple copy paste multiple range macro ARGUMENT ERROR

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
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
Simple Macro - I think... Copy - Paste on Click Scott Campbell[_2_] Excel Discussion (Misc queries) 5 November 14th 12 12:52 AM
Copy and paste over multiple sessions error Brad Excel Discussion (Misc queries) 0 January 4th 08 08:10 PM
Very Simple Copy and Paste Sheet - Error Sean Excel Programming 3 September 23rd 07 06:52 PM
How to write a simple copy-paste macro? R. H. Rosenberg New Users to Excel 4 November 25th 06 12:26 AM
Macro newbie - simple copy/paste function Nat Excel Programming 2 August 16th 06 05:37 PM


All times are GMT +1. The time now is 01:31 PM.

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"