Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rows(arguments)???

Hey all

another question

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


Thank

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Rows(arguments)???

Hi Dabith ,

Change:
Rows("1:Lastrow")
to:
Rows("1:" & LastRow).

Also, you are missing an End With and there is no need to select your range.
Therefore, your code could read :

With ActiveSheet
LastRow = (.UsedRange.Rows.Count + .UsedRange.Cells(1).Row - 1)
End With
Rows("1:" & LastRow).Copy

---
Regards,
Norman



"dabith " wrote in message
...
Hey all

another question

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


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Rows(arguments)???

Hi

Rows("1:" & Lastrow).Select

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"dabith " skrev i en meddelelse
...
Hey all

another question

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


---
Message posted from http://www.ExcelForum.com/



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
How many rows (arguments?) can be seached by Vlookup function? Ross Excel Discussion (Misc queries) 4 October 14th 08 04:39 AM
IF-more than 7 arguments in Carolina Excel Worksheet Functions 2 May 20th 08 08:46 PM
And, if, arguments.... Chuck_in_Mo Excel Worksheet Functions 19 February 12th 07 03:42 PM
Counting rows with two arguments [email protected] Excel Discussion (Misc queries) 7 October 3rd 06 03:24 AM
arguments gemini0662 Excel Discussion (Misc queries) 9 July 13th 06 03:48 PM


All times are GMT +1. The time now is 07:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"