Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
  #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


Reply With Quote
  #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


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.