Depends what you want.
RANGE = Worksheets("Sheet1").Range("A1:U1").End(xlDown) will select A to U
in the last row with data. It may not work if there are blanks in col A.
RANGE = Worksheets("Sheet1").Range("A1",range("U1").end(xldown).address)will
select the whole block
Best Regards
David Grugeon
Excel VBA Group Moderator
-----Original Message-----
From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com] On Behalf
Of Manny
Sent: Thursday, 7 March 2013 12:39 AM
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] define a range then use it in code
I am using the following code to define and declare a range:
Dim TRANGE As Range
TRANGE = Worksheets("Sheet1").Range("A1:U1").End(xlDown).Row
I tried to have the range selected using this code:
Range("TRANGE").Select
Of course that fails. What is the proper code to have this range selected?
Or does this make sense at all? I am a novice to VBA.
------------------------------------
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go
here: http://www.mousetrax.com/techtrax to enter the ezine, then search the
ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------Yahoo! Groups Links
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (4) |
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar