Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing specific items in a range


Just found this forum but also here I'm not able to find a answer to am
question.

Data in my sheet is arranged such that sometimes there's 1 or mor
spaces in between pieces of data. I thus create ranges usin
.SpecialCells(xlConstants) which works wonderfully.

My problem now is that the only way to run through the range to fin
something is to use the For Each option. I can't access e.g. the 5t
piece of data in such a range other then using For Each until I get t
the 5th item.

Does anyone know of a way to directly access items in ranges creat
using .SpecialCells(xlConstants)?

Thanks and best regards,

Leo

--
droopy928g
-----------------------------------------------------------------------
droopy928gt's Profile: http://www.excelforum.com/member.php...fo&userid=3023
View this thread: http://www.excelforum.com/showthread.php?threadid=49906

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Accessing specific items in a range

If you mean fifth group of data (or if each group is a separate cell):
Dim rng as Range
set rng = ActiveCell.EntireColumn.SpecialCells(xlConstants)
? rng.Address
$E$2:$E$4,$E$6,$E$8:$E$10,$E$13:$E$14,$E$16:$E$19, $E$21,$E$23,$E$28:$E$30
? rng.Areas(5).Address
$E$16:$E$19

use Areas.

If the groups have even numbers of cells, then you can calculate.

If the groups have variable numbers of cells, then you would need to loop



--
Regards,
Tom Ogilvy

"droopy928gt"
wrote in message
...

Just found this forum but also here I'm not able to find a answer to amy
question.

Data in my sheet is arranged such that sometimes there's 1 or more
spaces in between pieces of data. I thus create ranges using
SpecialCells(xlConstants) which works wonderfully.

My problem now is that the only way to run through the range to find
something is to use the For Each option. I can't access e.g. the 5th
piece of data in such a range other then using For Each until I get to
the 5th item.

Does anyone know of a way to directly access items in ranges create
using .SpecialCells(xlConstants)?

Thanks and best regards,

Leon


--
droopy928gt
------------------------------------------------------------------------
droopy928gt's Profile:

http://www.excelforum.com/member.php...o&userid=30232
View this thread: http://www.excelforum.com/showthread...hreadid=499064



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing specific items in a range


Hi Tom,

Thanks for the reply.

When I refer to data I'm referring to a cell with data in it, not an
area.

When a range is made up of consistent non empty cells you can use
..Item(5) to select the 5th item from that range. When I use this in
combination with a range made using .SpecialCells(xlConstants) then
item 1 will be the first item from the range where ever it may be
located, which is correct. Further items though are not correct in
cases where there are empty cells in between pieces of data.

In case of e.g. a range containing data in cells J7,J10,J11. What you
would get is e.g item 1 is J7, Item 2 is J8 and and item 3 is J9.

So I was hoping for there to be a way to directly address data in a
range using a accessing method like .item(x).

From your reply though this doesn't sound like being possible, right?


--
droopy928gt
------------------------------------------------------------------------
droopy928gt's Profile: http://www.excelforum.com/member.php...o&userid=30232
View this thread: http://www.excelforum.com/showthread...hreadid=499064

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Accessing specific items in a range

I explained what can be done.

--
Regards,
Tom Ogilvy


"droopy928gt"
wrote in message
...

Hi Tom,

Thanks for the reply.

When I refer to data I'm referring to a cell with data in it, not an
area.

When a range is made up of consistent non empty cells you can use
Item(5) to select the 5th item from that range. When I use this in
combination with a range made using .SpecialCells(xlConstants) then
item 1 will be the first item from the range where ever it may be
located, which is correct. Further items though are not correct in
cases where there are empty cells in between pieces of data.

In case of e.g. a range containing data in cells J7,J10,J11. What you
would get is e.g item 1 is J7, Item 2 is J8 and and item 3 is J9.

So I was hoping for there to be a way to directly address data in a
range using a accessing method like .item(x).

From your reply though this doesn't sound like being possible, right?


--
droopy928gt
------------------------------------------------------------------------
droopy928gt's Profile:

http://www.excelforum.com/member.php...o&userid=30232
View this thread: http://www.excelforum.com/showthread...hreadid=499064



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
=COUNTIF(range, select items highlighted with specific color) AA Excel Worksheet Functions 2 September 29th 09 05:28 PM
Counting items with a specific quanitifier in a date range sprillaman Excel Worksheet Functions 3 December 9th 08 08:25 PM
named range, data validation: list non-selected items, and new added items KR Excel Discussion (Misc queries) 1 June 24th 05 05:21 AM
How do I copy specific items to another worksheet? HEATHERCOX Excel Worksheet Functions 1 February 28th 05 02:00 PM
Accessing/Clearing range in hidden workbook DarrenW Excel Programming 2 July 17th 03 04:00 AM


All times are GMT +1. The time now is 10:12 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"