LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 414
Default Range copying macro question

Hello,

I've been trying learn, very slowly, how to do some things with macros. The
book I have, as well as many of the posts I've read over, say to not Select
things, but to just act on the range or cells directly. I'm posting part of
a macro I've written with a couple of questions in the text lines.

Sheets("Prior_Rev3").Range("A:E").Copy
Sheets("Rev_Final").Range("A1").PasteSpecial xlPasteValues
Application.CutCopyMode = False

Sheets("Criteria").Select
'Range("C7:C7").Select
'M = ActiveCell.Offset(0, 0).Value
M = Range("C7").Value


Select Case M

Case "January"

Sheets("Prior_Rev3").Range("F:Q").Copy
Sheets("Rev_Final").Range("F1").PasteSpecial xlPasteValues
Application.CutCopyMode = False
Sheets("Current_Rev3").Select
' These next lines do not work - WHY ?
' Sheets("Current_Rev3").Range("A2:E2", Range("A2:E2").End(xlDown)).Copy
' Sheets("Current_Rev3").Range("A2:E2").End(xlDown)) .Copy
' On the next line of code, why is the ranged listed twice ?
Range("A2:E2", Range("A2:E2").End(xlDown)).Copy
Sheets("Rev_Final").Range("A1").End(xlDown).Offset (1, 0). _
PasteSpecial xlPasteValues
Application.CutCopyMode = False
Sheets("Current_Rev3").Select
Range("F2", Range("F2").End(xlDown)).Copy
Sheets("Rev_Final").Range("F1").End(xlDown).Offset (1, 12). _
PasteSpecial xlPasteValues
Application.CutCopyMode = False

My questions are in the text lines of the January case. Basically, why does
the first line of the case work without having to select the sheet first, but
the following line has to have the sheet selected and why don't the two lines
that I've marked, work?

Sheets("Current_Rev3").Select
Range("A2:E2", Range("A2:E2").End(xlDown)).Copy
Sheets("Rev_Final").Range("A1").End(xlDown).Offset (1, 0). _
PasteSpecial xlPasteValues

Also, in some posts I've seen Destination:=

When is this used, as opposed to just tacking the sheet name on the front of
the line, as in

Sheets("Rev_Final").Range("F1").PasteSpecial xlPasteValues


I hope this is clear, as most of what I'm able to write is completely robbed
and reworked from the posts in this forum.

Thanks in advance,

Andy





 
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
Question on copying formulas Meenie Excel Worksheet Functions 1 February 13th 08 02:47 PM
Copying a Range Peter[_8_] Excel Discussion (Misc queries) 1 December 11th 07 04:14 AM
Copying Formulas Question Tom. Excel Discussion (Misc queries) 4 April 24th 06 03:55 AM
copying formula question DeeZi Excel Discussion (Misc queries) 2 June 30th 05 09:41 PM
Copying and Pasting---Another question... Tia Excel Discussion (Misc queries) 1 June 7th 05 07:41 PM


All times are GMT +1. The time now is 08:26 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"