Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've written some code to Search Row 1 for the word "Marty", then to search
down Column A for the word "CA", then to replace the correlating Cell contents with "OK". It seems to search and run, but it does not replace the Cell.Value="OK". Any suggestions? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I is difficult to comment without the code.
Could you post the relevant portions for review -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Option Explicit
Sub Test() FindAndReplace "Marty", "CA", _ Range("MyData"), "New Stuff" End Sub Private Sub FindAndReplace(sCol As String, _ sRow As String, _ rTable As Range, _ sNewValue As String) Dim iCOL As Long Dim iROW As Long On Error Resume Next iCOL = Application.WorksheetFunction.Match( _ sCol, rTable.Rows(1), False) iROW = Application.WorksheetFunction.Match( _ sRow, rTable.Columns(1), False) If iCOL * iROW = 0 Then MsgBox "Not Found" Else rTable.Cells(iROW, iCOL) = sNewValue End If on error goto 0 End Sub Patrick Molloy Microsoft Excel MVP -----Original Message----- I've written some code to Search Row 1 for the word "Marty", then to search down Column A for the word "CA", then to replace the correlating Cell contents with "OK". It seems to search and run, but it does not replace the Cell.Value="OK". Any suggestions? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to search in one column, and replace in the other column if fo | Excel Discussion (Misc queries) | |||
Search a column for values, return a value from adj column | Excel Worksheet Functions | |||
LookUp Function with Two Column Search Returning One Column Value | Excel Worksheet Functions | |||
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look | Excel Discussion (Misc queries) | |||
Search one column and return value from next column | Excel Discussion (Misc queries) |