Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Using Find and Replace

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Using Find and Replace

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Using Find and Replace

One way:
Columns("B:B").Find(What:="category",
LookAt:=xlWhole).Offset(,1).Activate



All the above is on one line. HTH Otto

"Nigel Bennett" wrote in message
...
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




  #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



.

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
Find & Replace: find part cell, replace whole cell katy Excel Worksheet Functions 3 April 3rd 23 01:20 PM
Find and Replace - Replace with Blank Space Studebaker Excel Discussion (Misc queries) 4 April 3rd 23 10:55 AM
where to put results of find operation in find and replace functio DEP Excel Worksheet Functions 5 November 15th 06 07:52 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
find replace cursor default to find box luffa Excel Discussion (Misc queries) 0 February 3rd 05 12:11 AM


All times are GMT +1. The time now is 02:49 AM.

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"