PC Review


Reply
Thread Tools Rate Thread

Activate Find Results

 
 
Steve C
Guest
Posts: n/a
 
      10th Jul 2009
I need code simply to activate all the cells found containing a text string
within a range of cells. For example, activate all cells containing
"Bioscience" in range A1:A350, including those that might say "Bioscience
Industry". Thanks!
--
Steve C
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      10th Jul 2009
Only one cell can be active at any given instance.


"Steve C" <(E-Mail Removed)> wrote in message
news:B4DE4847-9487-4554-8FF4-(E-Mail Removed)...
>I need code simply to activate all the cells found containing a text string
> within a range of cells. For example, activate all cells containing
> "Bioscience" in range A1:A350, including those that might say "Bioscience
> Industry". Thanks!
> --
> Steve C



 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      10th Jul 2009
Assuming you mean Select when you say Activate, this code will select all
cells with Bioscience in them (although I'm willing to bet you don't really
need to select them in order to do whatever you plan to do next)...

Sub GetBioscienceCells()
Dim C As Range
Dim FoundCells As Range
Dim FirstAddress As String
With Worksheets("Sheet2").Range("A2:H200") '<== Set sheet & range here
Set C = .Find("Bioscience", LookIn:=xlValues, _
LookAt:=xlPart, MatchCase:=False)
If Not C Is Nothing Then
FirstAddress = C.Address
Do
If FoundCells Is Nothing Then
Set FoundCells = C
Else
Set FoundCells = Union(C, FoundCells)
End If
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> FirstAddress
If Not FoundCells Is Nothing Then FoundCells.Select
End If
End With
End Sub

--
Rick (MVP - Excel)


"Steve C" <(E-Mail Removed)> wrote in message
news:B4DE4847-9487-4554-8FF4-(E-Mail Removed)...
>I need code simply to activate all the cells found containing a text string
> within a range of cells. For example, activate all cells containing
> "Bioscience" in range A1:A350, including those that might say "Bioscience
> Industry". Thanks!
> --
> Steve C


 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      11th Jul 2009
you can use Conditional Formatting to highlight cells with specific vales,
or use autofilter to parse a table for specific values

"Steve C" <(E-Mail Removed)> wrote in message
news:B4DE4847-9487-4554-8FF4-(E-Mail Removed)...
> I need code simply to activate all the cells found containing a text
> string
> within a range of cells. For example, activate all cells containing
> "Bioscience" in range A1:A350, including those that might say "Bioscience
> Industry". Thanks!
> --
> Steve C


 
Reply With Quote
 
Steve C
Guest
Posts: n/a
 
      14th Jul 2009
Yes, I meant Select (my bad for poor choice of words). Your code does
exactly what I was looking for. Thanks to all who responded.
--
Steve C


"Rick Rothstein" wrote:

> Assuming you mean Select when you say Activate, this code will select all
> cells with Bioscience in them (although I'm willing to bet you don't really
> need to select them in order to do whatever you plan to do next)...
>
> Sub GetBioscienceCells()
> Dim C As Range
> Dim FoundCells As Range
> Dim FirstAddress As String
> With Worksheets("Sheet2").Range("A2:H200") '<== Set sheet & range here
> Set C = .Find("Bioscience", LookIn:=xlValues, _
> LookAt:=xlPart, MatchCase:=False)
> If Not C Is Nothing Then
> FirstAddress = C.Address
> Do
> If FoundCells Is Nothing Then
> Set FoundCells = C
> Else
> Set FoundCells = Union(C, FoundCells)
> End If
> Set C = .FindNext(C)
> Loop While Not C Is Nothing And C.Address <> FirstAddress
> If Not FoundCells Is Nothing Then FoundCells.Select
> End If
> End With
> End Sub
>
> --
> Rick (MVP - Excel)
>
>
> "Steve C" <(E-Mail Removed)> wrote in message
> news:B4DE4847-9487-4554-8FF4-(E-Mail Removed)...
> >I need code simply to activate all the cells found containing a text string
> > within a range of cells. For example, activate all cells containing
> > "Bioscience" in range A1:A350, including those that might say "Bioscience
> > Industry". Thanks!
> > --
> > Steve C

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and replace results can the appearance of find be different? LLS at DPW Microsoft Excel Misc 2 26th Oct 2009 11:16 PM
where to put results of find operation in find and replace functio =?Utf-8?B?REVQ?= Microsoft Excel Worksheet Functions 5 15th Nov 2006 07:52 PM
Activate Macro based on Query Results =?Utf-8?B?VG9kZA==?= Microsoft Access 14 22nd May 2006 06:25 PM
Activate Macro based on Query Results =?Utf-8?B?VG9kZA==?= Microsoft Access 0 22nd May 2006 03:44 PM
Find Cell Value and Activate =?Utf-8?B?SmFtZXMgU3RlcGhlbnM=?= Microsoft Excel Programming 1 27th Apr 2004 07:45 PM


Features
 

Advertising
 

Newsgroups
 


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