Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA - Selecting Based on Criteria


Group,
Lets say I have two columns, in column A I have state names lik
Illinois, Indiana and Iowa. Lets also say in column B I have numbers.
How can I select a range of cells containing numbers for Illinois. Th
states will be continuously used. In other words, all the Illinoi
cells will follow each other, then right after the final Illinois cel
an Indiana range of cells will be continuous and so forth. On an
range selection, I'm only selecting one state at a time. Your thought
how I can overcome this problem.


Thanks again for all your assistance........


Ton

--
ajociu
-----------------------------------------------------------------------
ajocius's Profile: http://www.excelforum.com/member.php...fo&userid=1769
View this thread: http://www.excelforum.com/showthread.php?threadid=39362

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default VBA - Selecting Based on Criteria

try autofilter and copy flltered cells somewhere else


--
remove $$$ from email addresss to send email

===================
ajocius wrote in
message ...

Group,
Lets say I have two columns, in column A I have state names like
Illinois, Indiana and Iowa. Lets also say in column B I have numbers.
How can I select a range of cells containing numbers for Illinois. The
states will be continuously used. In other words, all the Illinois
cells will follow each other, then right after the final Illinois cell
an Indiana range of cells will be continuous and so forth. On any
range selection, I'm only selecting one state at a time. Your thoughts
how I can overcome this problem.


Thanks again for all your assistance........


Tony


--
ajocius
------------------------------------------------------------------------
ajocius's Profile:

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA - Selecting Based on Criteria

Tony,

Here is an example

Dim iLastRow As Long
Dim rng As Range

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Columns(1).AutoFilter
Columns(1).AutoFilter Field:=1, Criteria1:="Illinois"
Set rng = Range("A1:A" & iLastRow).SpecialCells(xlCellTypeVisible)
Columns(1).AutoFilter
rng.Select


--

HTH

RP
(remove nothere from the email address if mailing direct)


"ajocius" wrote in
message ...

Group,
Lets say I have two columns, in column A I have state names like
Illinois, Indiana and Iowa. Lets also say in column B I have numbers.
How can I select a range of cells containing numbers for Illinois. The
states will be continuously used. In other words, all the Illinois
cells will follow each other, then right after the final Illinois cell
an Indiana range of cells will be continuous and so forth. On any
range selection, I'm only selecting one state at a time. Your thoughts
how I can overcome this problem.


Thanks again for all your assistance........


Tony


--
ajocius
------------------------------------------------------------------------
ajocius's Profile:

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



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 rows with the same criteria Ruslan Excel Worksheet Functions 5 March 17th 10 12:49 AM
Query criteria based on a changing criteria list bwilk77 Excel Discussion (Misc queries) 2 May 27th 09 04:03 PM
Selecting rows based on criteria JCP Excel Discussion (Misc queries) 3 April 5th 06 09:26 AM
Selecting a criteria range over two sheets? Lord_Ilpalazo Excel Discussion (Misc queries) 1 July 29th 05 07:05 PM
Selecting Sheets based on Cell Criteria. Tim Richards Excel Programming 3 May 25th 05 12:28 AM


All times are GMT +1. The time now is 02:10 PM.

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"