Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default 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
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
Search and Replace, or Add New Row GEdwards Excel Discussion (Misc queries) 1 April 21st 10 08:20 AM
Search and Replace Rebecca New Users to Excel 2 June 5th 06 06:42 AM
Search and replace Subu Excel Worksheet Functions 4 June 9th 05 07:01 PM
Search and Replace Rebecca Excel Discussion (Misc queries) 1 May 14th 05 11:53 AM
Search and Replace... Paul B[_7_] Excel Programming 0 October 1st 03 06:12 PM


All times are GMT +1. The time now is 07:43 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"