![]() |
Search Row & Column
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? |
Search Row & Column
I is difficult to comment without the code.
Could you post the relevant portions for review -- Message posted from http://www.ExcelForum.com |
Search Row & Column
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? . |
All times are GMT +1. The time now is 11:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com