Wrox Programmer Forums
|
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
 
Old June 13th, 2004, 05:23 AM
Registered User
 
Join Date: Jun 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default rows(argument)

Hey all

Hoping someone can help a newbie to vba

how do I use the Lastrow variable in the Rows argument???

Dim Lastrow As Long
With ActiveSheet
Lastrow = .UsedRange.Rows.Count + .UsedRange.Cells(1).Row - 1

Rows("1:Lastrow").Select
Selection.Copy


Thanks



 
Old June 13th, 2004, 06:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is this what you seek:

Range("A1:A" & Lastrow).Select

..provided you only want to select data from column A
 
Old June 13th, 2004, 06:13 AM
Registered User
 
Join Date: Jun 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yep thanks for that






Similar Threads
Thread Thread Starter Forum Replies Last Post
ByRef Argument! Apocolypse2005 Beginning VB 6 11 August 9th, 2007 02:21 PM
Argument not Optional aziaraphale Excel VBA 5 August 1st, 2007 02:53 AM
Invalid Argument ppenn Access VBA 2 May 14th, 2007 10:11 AM
a Thread argument beccali Java Basics 1 February 21st, 2007 06:12 AM
Limit rows returned and next rows minhpx General .NET 1 August 12th, 2004 06:25 AM





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