PC Review


Reply
Thread Tools Rate Thread

Compare cell value to items in string

 
 
PamG
Guest
Posts: n/a
 
      3rd Oct 2008
I need to compare cell values in a column to a comma-delimited string. The
column has ID numbers and the string consists of a comma-delimited string of
ID numbers.

Any help would be appreciated....

Thanks
Pam
 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      3rd Oct 2008
Pam,

You've left out a lot of important details, but the following might
get you going in the right direction.

Sub AAA()
Dim R As Range
Dim V As Variant
Dim S As String
S = "11,22,33" '<<<< This is the data to test against
V = Split(S, ",")
For Each R In Range("A1:A10") '<<<< This is the range with data
' put alert in next column right
If IsError(Application.Match(CStr(R.Value), V, 0)) = True Then
R(1, 2) = "no match"
Else
R(1, 2) = "match"
End If
Next R
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
The San Diego Project Group, LLC
(email is on the web site)
USA Central Daylight Time (-5:00 GMT)




On Fri, 3 Oct 2008 08:24:04 -0700, PamG
<(E-Mail Removed)> wrote:

>I need to compare cell values in a column to a comma-delimited string. The
>column has ID numbers and the string consists of a comma-delimited string of
>ID numbers.
>
>Any help would be appreciated....
>
>Thanks
>Pam

 
Reply With Quote
 
PamG
Guest
Posts: n/a
 
      3rd Oct 2008
Thanks, Chip! Now I have another problem....this is my code that should copy
a row of data in one worksheet to the first blank row in another worksheet.
The problem is that the second worksheet has an additional column as column
one, so I want to copy worksheet 1 row (which starts on column A) to be
copied to worksheet 2 column B.

Sub check()

Dim stroldstring As String

' create string of "Issues" IDs
Windows("FIS1.18.xls").Activate
Sheets("Issues").Select
Range("B2", Range("B2").End(xlDown)).Select

stroldstring = ""
For Each cell In Selection
stroldstring = stroldstring & "," & Replace(cell.Value, " ", "")
Next

Dim R As Range
Dim V As Variant

V = Split(stroldstring, ",")
Sheets("Sheet1").Select
For Each R In Range("A1", Range("A1").End(xlDown))

If IsError(Application.Match(CStr(R.Value), V, 0)) = True Then
R.EntireRow.Copy Sheets("Issues").Range("B65536").End(xlUp)
.EntireRow.PasteSpecial Paste:=xlPasteValues


Else

End If
Next R

End Sub

This code still copies to worksheet 2, column A!


"PamG" wrote:

> I need to compare cell values in a column to a comma-delimited string. The
> column has ID numbers and the string consists of a comma-delimited string of
> ID numbers.
>
> Any help would be appreciated....
>
> Thanks
> Pam

 
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
FIND / SEARCH text compare cell to string in 3rd cell =?Utf-8?B?bmFzdGVjaA==?= Microsoft Excel Misc 0 29th Oct 2007 02:51 AM
Compare text string of a cell in Column A VS another cell in Colum =?Utf-8?B?VGFu?= Microsoft Excel New Users 2 1st Aug 2007 09:45 AM
Compare text string of a cell in Column A VS another cell in Colum =?Utf-8?B?VGFu?= Microsoft Excel Misc 1 1st Aug 2007 09:03 AM
Compare text string of a cell in Column A VS another cell in Colum =?Utf-8?B?VGFu?= Microsoft Excel Worksheet Functions 1 1st Aug 2007 09:01 AM
Compare text string of a cell in Column A VS another cell in Colum =?Utf-8?B?VGFu?= Microsoft Excel Programming 0 30th Jul 2007 05:12 PM


Features
 

Advertising
 

Newsgroups
 


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