PC Review


Reply
Thread Tools Rate Thread

Check values in cells and replace them if they are the same value

 
 
=?Utf-8?B?Rmlubg==?=
Guest
Posts: n/a
 
      22nd Mar 2007
Need some help to make a macro that check value in B3 against values in D3,
F3, H3 if any of the values are the same as in B3 it shall be replaced with
value in A3.

Then it shall go to B4 and do the same sheck With D4 , F4 and H4 untill it
reach the last entry inn B collone

Finn
 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      22nd Mar 2007
Does it make any difference if we change B3 or change the cell that matches
its value?
--
Gary''s Student
gsnu200711

 
Reply With Quote
 
matt
Guest
Posts: n/a
 
      22nd Mar 2007
On Mar 22, 3:07 pm, Gary''s Student
<GarysStud...@discussions.microsoft.com> wrote:
> Does it make any difference if we change B3 or change the cell that matches
> its value?
> --
> Gary''s Student
> gsnu200711


This should work. (It hasn't been tested)

Option Explicit
Sub macro1()
Dim a
Dim counter
Dim aVal

counter = Range("A1").CurrentRegion.Rows.Count

For a = 1 To counter
aVal = Range("A" & a).Value

If Range("B" & a).Value = Range("D" & a).Value Then
Range("D" & a).Value = aVal
End If

If Range("B" & a).Value = Range("F" & a).Value Then
Range("F" & a).Value = aVal
End If

If Range("B" & a).Value = Range("H" & a).Value Then
Range("H" & a).Value = aVal
End If
Next

End Sub

 
Reply With Quote
 
=?Utf-8?B?Rmlubg==?=
Guest
Posts: n/a
 
      23rd Mar 2007


"matt" wrote:

> This should work. (It hasn't been tested)


Thanks it works excellent

 
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
macro to check if cells have values in them...then Jim A Microsoft Excel Discussion 4 9th Jan 2009 05:36 PM
Check that all cells in a range have same values Finny388 Microsoft Excel Programming 2 11th Jul 2007 04:45 PM
check value in cells against all values in a column =?Utf-8?B?Rmlubg==?= Microsoft Excel Programming 3 29th Mar 2007 01:34 PM
Replace values in shaded cells with blanks sue Microsoft Excel Misc 3 11th Jan 2007 01:20 AM
Replace values in cells in one column Vads Microsoft Excel Worksheet Functions 3 27th Jan 2004 01:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:47 AM.