Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 28th, 2005, 04:26 PM
Registered User
 
Join Date: Oct 2005
Location: minneapolis, mn, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copying ranges

Currently I copy and paste a range of cells one cell at a time because I can't get a range using a start and end variable (to be determined by an ealrier loop counting where the cells start and end) such as Range("A" & i : "A" & intLastRow).select.
Any ideas how i could copy the whole range, and then move it over and paste the whole thing, rather than coying each cell individually? Below is what I'm currenlty doing:

'Load Dates into RelativeValueGraph
Dim strCurrentDate As String
i = 9
d = 258
Windows("IWS many lines.xls").Activate
Range("A" & i).Select
Do While Range("A" & i).Value = 1
Range("C" & i).Select
Selection.Copy
Windows("RelativeValueGraphs.xls").Activate
Range("A" & d).PasteSpecial Paste:=xlPasteValues
i = i + 1
d = d + 1
Windows("IWS many lines.xls").Activate
Loop
  #2 (permalink)  
Old October 31st, 2005, 10:17 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hows it going? Not sure if this is the most effective method and some real programers may point out the downfalls of the following
'Load Dates into RelativeValueGraph
Dim strCurrentDate As String
i = 9
d = 258
Windows("IWS many lines.xls").Activate
Range("A" & i).Select
Do until activecell.value = ""
i=i+1
activecell.offset(1,0).select
Loop
'Looks like you were using column A as reference but copying column C if that is the case then as follows
Range("C9" : "C" & i).select.
Selection.Copy
'For the paste section just select the cell you are string from and drop the range in
Windows("RelativeValueGraphs.xls").Activate
'Range("A" & d).PasteSpecial Paste:=xlPasteValues
Range("A1").PasteSpecial Paste:=xlPasteValues 'start range?

Hope this helps
Regards
Rob


  #3 (permalink)  
Old November 2nd, 2005, 06:35 AM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to shattered Send a message via Yahoo to shattered
Default

Currently I copy and paste a range of cells one cell at a time because I can't get a range using a start and end variable (to be determined by an ealrier loop counting where the cells start and end) such as Range("A" & i : "A" & intLastRow).select.
Any ideas how i could copy the whole range, and then move it over and paste the whole thing, rather than coying each cell individually?

You can do it the way you want, your range just has the " in the wrong places and is missing a &

Range("A" & i : "A" & intLastRow).select.
should read
Range("A" & i & ":A" & intLastRow).Select




Similar Threads
Thread Thread Starter Forum Replies Last Post
Matching Values between two ranges hood8jmark Excel VBA 2 May 2nd, 2008 09:55 AM
Date Ranges nbuckwheat Access 1 December 12th, 2005 12:45 PM
Select multiple ranges.... Mats Excel VBA 2 June 9th, 2005 08:01 AM
date ranges yuqlin BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 2 December 23rd, 2004 05:23 PM
Variable data Ranges dgarcia1128 Excel VBA 3 June 20th, 2003 02:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.