LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default if cell value matches then copy another cell


Hey there,

I was able to get some help before with a problem that consisted of
checking two excel files for cell matches and placing either a "Exists"
or "Does Not Exist" in a cell depending on if the cell value in one
excel file exists in another. This was done to help sort out what
products existed in the one file but not the other.

That has been working great!!!

Now I have a new problem and I have tried to do it myself but not being
to familiar with excel macros I am having a hard time.

I still want the macro below to do what it does, but is there a way to
put the standard "Exists" and "Does not exist" as well as copy cell C
from the new to the old as well?

I have two sheets that have mostly the same data, though not in the
same order. The old sheet has descriptions that have been cut off, the
new has the full descriptions. I need to compare cell A of new to cell
A of old and if they match it writes "Exists" and then copies cell C
from the new to cell C from the old. Get it?

I just want to make sure the full descriptions are copied over the
incomplete ones. Would be easy if all the data was in same order, but
it isn't. When I tried to do it it just copied straight down the
list... which doesn't match.

Here is the macro that was first given to me to figure out which items
in the new existed in the old, and vice versa.

Sub CheckExistenceCopy()
Dim NewRange As Range
Set NewRange = Range("'walloffame-u864xprt.xls'!A:A")

Dim OldRange As Range
Set OldRange = Range("'toystore-112105.XLS'!A:A")

Dim NrIndex As Long
Dim OrIndex As Long

Dim SearchedFor As Range

For NrIndex = 1 To NewRange.Rows.Count
If NewRange.Item(NrIndex).Value < "" Then
Set SearchedFor = OldRange.Find(NewRange.Item(NrIndex),
LookIn:=xlValues)

If Not SearchedFor Is Nothing Then
Range("'walloffame-u864xprt.xls'!B" & NrIndex).Value = "Exists"
Else
Range("'walloffame-u864xprt.xls'!B" & NrIndex).Value = "Does Not
Exist"
End If
End If
Next NrIndex
End Sub

I see where the match occurs and does not. I just can't figure out how
to tell it that when it matches insert the value "Exists" AND copy cell
C from new to old sheet.

I'm sure it is something pretty simple. It always seems to be
simplicity that gets me. Kinda like not being able to see the forrest
for the trees.


I am attaching new and old sheets so you can see what I mean.

I hope I have explained this well. I need to copy the description from
new to old as well as do the "exist" and "does not exist"

The only difference is the attached are .txt and in the macro they are
..xls (Because I can only attach a .txt)

Thanks,

Bill


+-------------------------------------------------------------------+
|Filename: walloffame-u864xprt.txt |
|Download: http://www.excelforum.com/attachment.php?postid=4073 |
+-------------------------------------------------------------------+

--
billbeecham
------------------------------------------------------------------------
billbeecham's Profile: http://www.excelforum.com/member.php...o&userid=16286
View this thread: http://www.excelforum.com/showthread...hreadid=488417

 
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
Maddening Dilemma - Compare each cell within column a to each cell in column b and find unique matches [email protected] Excel Worksheet Functions 66 May 1st 23 03:44 AM
Returning Cell Value if Matches Another cell frankjh19701 Excel Worksheet Functions 5 February 13th 11 09:33 PM
Tab name matches cell Nigel[_18_] Excel Programming 2 August 11th 05 08:22 PM
Find first and/or last cell that matches data Molasses26 Excel Programming 2 April 8th 05 08:43 PM


All times are GMT +1. The time now is 10:20 AM.

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"