>
> In fact I used a slightly different code... It finds a row with a certain 
> value (the risk id for my case) and replace another value in the same row 
> that I set. I hope I this code helps others as well! Thank you again for 
> all your help and feedback!!!
>
 
Sorry for the comments but I think they could be useful to another beginner 
such as me!
 
Sub replace()
Dim WS As Worksheet
Dim Search As String
Dim Replacement As String
Dim Prompt As String
Dim Title As String
Dim ID As String
 
'''''''''''''''''''' Set the unique value in each row
Prompt = "What is the risk ID?"
Title = "Search Value Input"
ID = InputBox(Prompt, Title)
 
 
''''''''''''''''''Set the value in the specific row I want to replace 
Prompt = "What is the original value you want to replace?"
Title = "Search Value Input"
Search = InputBox(Prompt, Title)
 
 
'''''''''''''''''''Set the new value
Prompt = "What is the replacement value?"
Title = "Search Value Input"
Replacement = InputBox(Prompt, Title)
 
 
 
 
For Each WS In Worksheets              ''''''''''''' A 'for' command to 
search in all worksheets
 
   Cells.Find(What:=ID, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
        xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, 
MatchCase:=False _       '''''''''''''''' Finds and activates the cell that 
contains the first value      
        , SearchFormat:=False).Activate
    ActiveCell.EntireRow.Select          ''''''''''''''''' Selects the 
entire row

    
    Selection.replace What:=Search, Replacement:=Replacement, 
LookAt:=xlWhole, _           ''''''''''''''Searches the row and replaces 
the value
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
Next

End Sub 

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to