Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Selecting range based on values




I want to select a range consisting of the rows in column B which contain a
certain value (5). These will all be adjacent to one another. Then extract
the corresponding values in column M in only these rows to be used for later
analysis.

#How can I extract these values into a single column in another worksheet?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting range based on values

Sub GetCells()
dim res as Variant, rng1 as range
dim lastrow as Long, rng as Range
res = Application.Match(5,Columns(2),0)
lastrow = res
do while cells(lastrow,2) = 5
lastrow = lastrow + 1
Loop
set rng = Range(cells(res,2),cells(lastrow - 1,2))
set rng1 = Intersect(columns(13),rng.EntireRow)

rng1.select
End Sub

rng1 will hold a reference to the cells in column M.

--
Regards,
Tom Ogilvy


"Alan M" wrote in message
...



I want to select a range consisting of the rows in column B which contain

a
certain value (5). These will all be adjacent to one another. Then extract
the corresponding values in column M in only these rows to be used for

later
analysis.

#How can I extract these values into a single column in another worksheet?



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
Selecting a range of cells based on the date. Solomon Excel Worksheet Functions 1 February 12th 10 09:11 AM
Selecting series in a chart based on a range and manual inputs Tigerxxx Excel Discussion (Misc queries) 0 July 19th 09 12:36 AM
Selecting values from a range that equal a specific total Matt UK Excel Worksheet Functions 4 November 25th 06 09:42 PM
Selecting a range of values for another function Sergun Excel Worksheet Functions 4 November 24th 05 10:45 PM
Selecting data from a list based on entered values GrantM Excel Discussion (Misc queries) 1 December 20th 04 10:59 AM


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