PC Review


Reply
Thread Tools Rate Thread

check value in cells against all values in a column

 
 
=?Utf-8?B?Rmlubg==?=
Guest
Posts: n/a
 
      29th Mar 2007

Need some help to make a macro that check value in C3 against all values in
column D,F and H if any of the values are the same as in B3 it shall be
replaced withvalue in A3.

Then it shall go to C4 and do the same sheck With column D , F and H if
matching values too B4 replace them with value in A4 untill it reach the last
entry inn B column B


Finn
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      29th Mar 2007
The logic for this is confusing:-

compare C3 to columns D,F & H
if any values are the same as B3 replace them with the value in A3

C3 is therefore never actually used. Please clarify

Mike

"Finn" wrote:

>
> Need some help to make a macro that check value in C3 against all values in
> column D,F and H if any of the values are the same as in B3 it shall be
> replaced withvalue in A3.
>
> Then it shall go to C4 and do the same sheck With column D , F and H if
> matching values too B4 replace them with value in A4 untill it reach the last
> entry inn B column B
>
>
> Finn

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


"Mike" wrote:

> The logic for this is confusing:-
>
> compare C3 to columns D,F & H
> if any values are the same as B3 replace them with the value in A3
>
> C3 is therefore never actually used. Please clarify
>
> Mike


Compare value inn "C3" with values in all cells inn D,F &H and with any
duplicates too value in C3 exchange with value inn "A3" , next go to "C4" and
do the same routine but now exhange values with "A4" until it reach end
 
Reply With Quote
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      29th Mar 2007
Hi Finn,

This macro searches colummn D for the value in C3 and if true replaces it
with the value in A3. You should be able to follow the logic to do the other
columns.

Sub Macro2()
Dim lastrow As Long
checkvalue = Cells(3, 3).Value
replacevalue = Cells(3, 1)
lastrow = Cells(Cells.Rows.Count, "d").End(xlUp).Row
For x = lastrow To 1 Step -1
Cells(x, 4).Select
foundvalue = Cells(x, 4).Value
If foundvalue = checkvalue Then
Cells(x, 4).Value = replacevalue
End If
Next
End Sub

Mike

"Finn" wrote:

>
>
> "Mike" wrote:
>
> > The logic for this is confusing:-
> >
> > compare C3 to columns D,F & H
> > if any values are the same as B3 replace them with the value in A3
> >
> > C3 is therefore never actually used. Please clarify
> >
> > Mike

>
> Compare value inn "C3" with values in all cells inn D,F &H and with any
> duplicates too value in C3 exchange with value inn "A3" , next go to "C4" and
> do the same routine but now exhange values with "A4" until it reach end

 
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
calculate values in an unlimited range of cells in a column WITHOUTalso calculating values that had previously been filtered AGAINST? yadang Microsoft Excel Misc 2 1st Oct 2009 06:18 PM
Total cells of one column based on the values in another column? Riccol Microsoft Excel New Users 10 1st Feb 2009 09:07 AM
Count cells w/values in column if the data in column a matches cri mdcgpw Microsoft Excel Worksheet Functions 3 11th Jan 2009 09:00 PM
Loop through column(s) to check values, perform action based on check ward376 Microsoft Excel Programming 4 6th Nov 2007 03:21 PM
macro to transpose cells in Column B based on unique values in Column A Aaron J. Microsoft Excel Programming 3 8th Oct 2004 02:29 PM


Features
 

Advertising
 

Newsgroups
 


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