View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Searching for a value for and then replacing when found.

Sub getNfix()
Dim c As Range
Dim ws As Worksheet
Set ws = Worksheets(1) 'Change to actual
For Each c In ws.Range("E5:E10")
If c = Range("a1").Value Then
c.Value = Range("B1").Value
End If
Next

" wrote:

Can someone tell me how I would do the following:

- I have numbers in cells E5:E10; A1 and B1
- I would like to search for A1 in cells E5:E10
- On the first instance I find of A1, I would like to replace the
value of that cell with B1

What would be a simple way to write this?

Thanks,
Fish