Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default check value in cells against all values in a column


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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default check value in cells against all values in a column

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default check value in cells against all values in a column



"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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default check value in cells against all values in a column

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
If value is true the check column for specific values MrPetreli Excel Discussion (Misc queries) 1 January 24th 12 11:50 PM
check for FALSE values in a range of cells in VBA Dave F[_2_] Excel Discussion (Misc queries) 2 August 7th 07 04:12 PM
Check values in cells and replace them if they are the same value Finn Excel Programming 3 March 23rd 07 02:17 AM
Check for list of 3 values (alpha) in a column GeeSexAah Excel Programming 2 November 28th 04 11:37 PM
Check for list of 3 values (alpha) in a column GeeSexAah[_2_] Excel Programming 0 November 22nd 04 12:08 PM


All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"