Results 1 to 6 of 6

Need help Converting Code to Read Alpha Numeric Legends instead of single character legend

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Need help Converting Code to Read Alpha Numeric Legends instead of single character legend

    This code below automates a process for me with single digit characters 0 through 9 and A through Z legends. I would now like it to work with Legends which are Just Letters Alone or Letters accompanied by a number. So For Example Legend "OVRV1" in the current code would read the legends as O, V, R, V, 1. The way the new code would behave would read it as O,V,R, V1
    Legends are an alphabet letter alone or an alphabet accompanied by a letter. It should understand that V1 is not V even though V is contained in V1. Any Help Would be Great.

    Including a file below which should explain what the macro currently does and what i need it to do , this should help clear out any issues. The Code below is the original code.

    It should be noted the code pulls legends verbiage from its corresponding Legend in Column B. If the Legend has a Dash in it for example ORV-D1H the legends D,1, and H pull verbiage from the orange area and the O, R V Legends from the Light Green Area. Running the macro in the example file will clear any confusion.

    Sub singletest() 
    Dim colEnd As Long, r As Range, n As Integer, k As Integer
    colEnd = Cells(1, 3).End(xlToRight).Column
    Application.ScreenUpdating = False
    Application.CutCopyMode = False
    For Each r In Range("c1").Resize(, colEnd - 2)
        a = Split(r.Value, "-")
        For n = 0 To UBound(a)
            For k = 1 To Len(a(n))
                With Columns(1)
                    Set c = .Find(Mid(a(n), k, 1), , , 1)
                        If Not c Is Nothing Then
                            f = c.Address
                            Do
                                If n > 0 Then
                                    If c.Interior.Color = RGB(255, 192, 0) Then
                                        c.Offset(, 1).Copy Cells(c.Row, r.Column)
                                    End If
                                Else
                                    If c.Interior.Color <> RGB(255, 192, 0) Then
                                        c.Offset(, 1).Copy Cells(c.Row, r.Column)
                                    End If
                                End If
                            Set c = .FindNext(c)
                            Loop Until f = c.Address
                        End If
                End With
            Next
        Next
    Next
    Application.CutCopyMode = True
    Application.ScreenUpdating = True
    MsgBox "Copying has been completed", vbInformation, "Done!"
    End Sub
    Attached Files Attached Files
    Last edited by donnydorko; 12-29-2012 at 01:12 AM.

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