Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default spreadsheet range selection

I have a spreadsheet with stuff in various cells but my main area of interest
is A11 to I(where ever it ends)

For some reason when I select using this
Range("A11").CurrentRegion.Select

I get header cells and other unwanted stuff, it actually selects A8 to I
(where ever it ends)

How do I select only A11 to I(where ever it ends) regardless of what is
around it?

Thanks
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default spreadsheet range selection

xlLastCell will give you the last cell on the spreadsheet. If you want
to know exactly which one that is, open the spreadsheet and hit ctrl +
end.

So something like... range("A11", xlLastCell).Select should work.

Is this what you were looking for?

paqo

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default spreadsheet range selection

Hi

CurrentRegion does just that (by definition), it returns continuous cells by
looking in the following direction: up, down, and diagonal.
In you case, you would use:
Dim rg as range
rg= range("A11")

'to select the last cell before the next blank, use:
Range(rg, rg.end(xlright)).select
'but then, say there is a blank in F11, but data in G11, it will
stop in E11:
' right before the next blank(F11)

'to select up to the last cell of data in row 11:
Range(rg, rg.EntireRow.Cells(256).End(xlToLeft)).Select
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Mike" wrote:

I have a spreadsheet with stuff in various cells but my main area of interest
is A11 to I(where ever it ends)

For some reason when I select using this
Range("A11").CurrentRegion.Select

I get header cells and other unwanted stuff, it actually selects A8 to I
(where ever it ends)

How do I select only A11 to I(where ever it ends) regardless of what is
around it?

Thanks
Mike

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default spreadsheet range selection

one precision: my previous post was for the case on searching end of data on
a row not column ('cause you were saying A8 to I, and i thought 'I' was
representing the column I).
For searching for up to the last cell in the column A, use:
Dim rg as range
rg= range("A11")

'to select up to the last cell of data in column A:
Range(rg,
rg.EntireColumn.Cells(rg.EntireColumn.Cells.count) .End(xlUp)).Select

'to select the last cell before the next blank, use:
Range(rg, rg.end(xlUp)).select

--
Regards,
Sébastien
<http://www.ondemandanalysis.com

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"sebastienm" wrote:

Hi

CurrentRegion does just that (by definition), it returns continuous cells by
looking in the following direction: up, down, and diagonal.
In you case, you would use:
Dim rg as range
rg= range("A11")

'to select the last cell before the next blank, use:
Range(rg, rg.end(xlright)).select
'but then, say there is a blank in F11, but data in G11, it will
stop in E11:
' right before the next blank(F11)

'to select up to the last cell of data in row 11:
Range(rg, rg.EntireRow.Cells(256).End(xlToLeft)).Select
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Mike" wrote:

I have a spreadsheet with stuff in various cells but my main area of interest
is A11 to I(where ever it ends)

For some reason when I select using this
Range("A11").CurrentRegion.Select

I get header cells and other unwanted stuff, it actually selects A8 to I
(where ever it ends)

How do I select only A11 to I(where ever it ends) regardless of what is
around it?

Thanks
Mike

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default spreadsheet range selection

In this case it is safest to come up from the bottom of the sheet. xlLastCell
and CurrentRegion will give you problems... Try this

range("A11", cells(rows.count, "A").end(xlUp)).select
--
HTH...

Jim Thomlinson


"Mike" wrote:

I have a spreadsheet with stuff in various cells but my main area of interest
is A11 to I(where ever it ends)

For some reason when I select using this
Range("A11").CurrentRegion.Select

I get header cells and other unwanted stuff, it actually selects A8 to I
(where ever it ends)

How do I select only A11 to I(where ever it ends) regardless of what is
around it?

Thanks
Mike



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default spreadsheet range selection

Can't you select explicitly:

Range("A11:I100").Select

or

i = 50
Range(Cells(11, 1), Cells(i, 9)).Select

if the depth of column I is variable
--
Gary''s Student


"Mike" wrote:

I have a spreadsheet with stuff in various cells but my main area of interest
is A11 to I(where ever it ends)

For some reason when I select using this
Range("A11").CurrentRegion.Select

I get header cells and other unwanted stuff, it actually selects A8 to I
(where ever it ends)

How do I select only A11 to I(where ever it ends) regardless of what is
around it?

Thanks
Mike

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
Emailing a selection from Excel spreadsheet Tom K[_3_] Excel Discussion (Misc queries) 1 April 22nd 09 01:59 PM
Narrow Range based on Selection in Another Range David Excel Discussion (Misc queries) 3 July 1st 07 05:12 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM
Creating range name for a range selection Mervyn Thomas Excel Programming 1 January 26th 04 05:18 PM


All times are GMT +1. The time now is 02:29 AM.

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

About Us

"It's about Microsoft Excel"