ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting a Range (https://www.excelbanter.com/excel-programming/314884-selecting-range.html)

KulbirSingh[_2_]

Selecting a Range
 

I want to write up a macro to set print area of my sheets in a file
Here is the process I use:

I select B11

I do shift + down arrow

I continue holding shift and go to Column J

I set up this range to be print-area range.

when I record the macro, it gives me absolute range for print area an
as such I can't use this macro for other sheets where the print are
could be different.

How do you write "Shift + up arrow" in VBA.

Sorry for the stupid question but I am just a newbie in programming an
need your help.

Thanks,
Kulbir Sing

--
KulbirSing
-----------------------------------------------------------------------
KulbirSingh's Profile: http://www.excelforum.com/member.php...fo&userid=1562
View this thread: http://www.excelforum.com/showthread.php?threadid=27277


Frank Stone

Selecting a Range
 
hi
the line you may be looking for is
Range("A1",Range("A1").end(xldown).Offset(0,10))
this will select a range starting at a1 down to the
lastrow of data(assumming there are no blanks) and over 10
columns(J).
Another way
cells(1,1).select
Selection.CurrentRegion.Select
Regards
Frank
-----Original Message-----

I want to write up a macro to set print area of my sheets

in a file.
Here is the process I use:

I select B11

I do shift + down arrow

I continue holding shift and go to Column J

I set up this range to be print-area range.

when I record the macro, it gives me absolute range for

print area and
as such I can't use this macro for other sheets where the

print area
could be different.

How do you write "Shift + up arrow" in VBA.

Sorry for the stupid question but I am just a newbie in

programming and
need your help.

Thanks,
Kulbir Singh


--
KulbirSingh
----------------------------------------------------------

--------------
KulbirSingh's Profile:

http://www.excelforum.com/member.php?
action=getinfo&userid=15621
View this thread:

http://www.excelforum.com/showthread...hreadid=272775

.



All times are GMT +1. The time now is 11:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com