Results 1 to 12 of 12

VB Number Matching Help Required

Threaded View

  1. #1
    Registered User
    Join Date
    03-10-2011
    Location
    Guelph, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    18

    VB Number Matching Help Required

    Hi all,

    I have run into an odd error in a program I'm writing, and have isolated the problem with a smaller sub-code. Basically my code checks to see if the first digit in an integer matches a whole number in another cell. For the most part the code works fine, but in some situations it fails to recognize matches and I can't figure out why. The following is what my sheet looks like, as well as the code I wrote to check this error.

    Col.A Col.B
    R1 2.11 2
    R2 2.21 2
    R3 2.32 2
    R4 2.12 2
    R5 2.22 2
    R6 2.32 2

    Sub testing()
    
    For x = 1 To 6
        y = Range("A" & x)
        y2 = y - Right(y, 3)
        If y2 = Range("B" & x) Then
            Range("C" & x) = "yes"
        Else
            Range("C" & x) = "no"
        End If
        
        
    Next x
    
    End Sub
    I don't know if there is a basic solution for this, but I'm stumped, and any help would be greatly appreciated.
    Last edited by hamhains; 07-27-2011 at 01:13 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1