Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find & Replace: find part cell, replace whole cell | Excel Worksheet Functions | |||
Find and Replace - Replace with Blank Space | Excel Discussion (Misc queries) | |||
where to put results of find operation in find and replace functio | Excel Worksheet Functions | |||
find and replace - replace data in rows to separated by commas | Excel Worksheet Functions | |||
find replace cursor default to find box | Excel Discussion (Misc queries) |