Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search & Replace
Trying to get this to work. I want the macro to search a row for a certain
value, then search the column for a certain value, then return a certain value into the corresponding cell. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search & Replace
Hi John,
Apparently pertinent to your request, Patrick Malloy recently posted the following: ---------------------------------------------------------- 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 ------------------------------------------------------- --- Regards, Norman "John Keturi" wrote in message news:rAytc.325$mm1.24@fed1read06... Trying to get this to work. I want the macro to search a row for a certain value, then search the column for a certain value, then return a certain value into the corresponding cell. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search & Replace
Hi John,
http://www.mvps.org/dmcritchie/excel/vlookup.htm#match --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "John Keturi" wrote in message news:rAytc.325$mm1.24@fed1read06... Trying to get this to work. I want the macro to search a row for a certain value, then search the column for a certain value, then return a certain value into the corresponding cell. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search and Replace, or Add New Row | Excel Discussion (Misc queries) | |||
Search and Replace | New Users to Excel | |||
Search and replace | Excel Worksheet Functions | |||
Search and Replace | Excel Discussion (Misc queries) | |||
Search and Replace... | Excel Programming |