PC Review


Reply
Thread Tools Rate Thread

How to change a value in a cell based on finding value in another

 
 
=?Utf-8?B?TGF1cmllIEJvcm4=?=
Guest
Posts: n/a
 
      6th May 2007
I want to perform a search of entire spreadsheet and when a specified value
is found a replace is performed in a specified cell of a specified value. I
want to code this in VB to be used as a macro.
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      6th May 2007
Examples?

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Laurie Born" <Laurie (E-Mail Removed)> wrote in message
news:3A6EF0AC-A4CB-4523-96AD-(E-Mail Removed)...
>I want to perform a search of entire spreadsheet and when a specified value
> is found a replace is performed in a specified cell of a specified value.
> I
> want to code this in VB to be used as a macro.


 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      6th May 2007
This might work. You will have to change a couple of items in the code where
I have so noted.

Sub srchWks()
Dim myRng As Range, myVar As Variant
Dim RangeToChange As Range, newValue As Variant
RangeToChange = Cells(5, 5) '<<< Change to actual
newValue = "Hello" '<<< Change to actual
Set myRng = ActiveSheet.UsedRange
With myRng
Set c = .Find(myVar, LookIn:=xlValues) '<<< Define myVar
If Not c Is Nothing Then
fRng = c.Address
RangeToChange.Value = newValue
End If
End With
End Sub

"Laurie Born" wrote:

> I want to perform a search of entire spreadsheet and when a specified value
> is found a replace is performed in a specified cell of a specified value. I
> want to code this in VB to be used as a macro.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
finding and then moving entire row to new sheet based on cell value dave chamberlan Microsoft Excel Misc 2 17th Nov 2009 01:27 AM
Finding the Row number based on contents of a cell Chris Youlden Microsoft Excel Worksheet Functions 5 6th Sep 2007 04:38 PM
Finding cell contents based on certain criteria thekovinc Microsoft Excel Misc 1 15th Mar 2006 07:37 PM
Finding cell contents based on certain criteria thekovinc Microsoft Excel Misc 1 15th Mar 2006 07:20 PM
formula for finding value in a cell based on date Scott Microsoft Excel Worksheet Functions 1 12th Aug 2003 09:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:14 AM.