View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Using Find and Replace

This works but I have one further question

How do I make so that it finds only that word not the
first instance, it must match the word exactly

currently if finds "sub category" and I want ot to find
only the cell where the word is Category"


thanks


-----Original Message-----
Your question is a little unclear but this code will

find a string and move
the active cell one cell to the right of it. The code is

mighty generic so
you can select whatever range you ant to serach on

whatever sheet you want to
search.

Sub test()
Call FindString("1") 'Implementation
End Sub

Public Sub FindString(ByVal strTextToFind As String)
Dim wksCurrent As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range

Set wksCurrent = ActiveSheet
Set rngToSearch = wksCurrent.Range("B1").EntireColumn
Set rngFound = rngToSearch.Find(strTextToFind)

If Not rngFound Is Nothing Then rngFound.Offset(0,

1).Select
End Sub



"Nigel Bennett" wrote:

What I need to do is find a value in a column and then
have the column directly to the right of that become

the
active cell regardless of how far down the spreadsheet

it
may be

eg I am looking for the word category in column B One

day
it is in cell B56 so I want to refrence cell C56, the

next
day it is in cell b45 I want to reference cell C45

Hope someone can help

Thanks



.