Results 1 to 4 of 4

Need to modify Existing Code

Threaded View

  1. #1
    Registered User
    Join Date
    10-13-2010
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2010
    Posts
    55

    Need to modify Existing Code

    Hi,

    I have this code that was created for me awhile back by Event 21 and I need to modify it so that I can change the column that the color coding is going to. Also would be nice to be able to have multiple columns color coded. I would appreciate it greatly if you could explain what the different lines do. I know enough about VBA to be dangerous and I don't want to mess up this great code. It works great for the one project, but I have a couple of others that need to have it expanded. I have found that depending on what we are auditing the column that I need color coded will be in different locations.

    [/Sub colorCodeSplit()
    Dim a, lr&, r, txt, stxt, ii&, i&, ctr%, ctrCode%
    Dim dic As Object
    With Application
        .ScreenUpdating = False
    End With
    Set dic = CreateObject("scripting.dictionary")
        With Sheet1
            lr = .Cells(.Rows.Count, 1).End(xlUp).Row
            a = .Range("a7:a" & lr).Value
        End With
        For Each r In a
            If Not dic.exists(Trim(r)) Then
                dic.Add Trim(r), Trim(r)
            End If
        Next
    ii = 7
    With Sheet8
        lr = .Cells(.Rows.Count, 4).End(xlUp).Row
        a = .Range("d6:d" & lr).Value
        For i = 2 To UBound(a, 1)
            txt = Split(a(i, 1), ",")
            ctr = 1: ctrCode = 0
            For Each stxt In txt
                If dic.exists(Trim(stxt)) Then
                    With Cells(ii, 4)
                        ctrCode = ctrCode + 1
                        .Characters(Start:=ctr, Length:=Len(stxt)).Font.Color = RGB(0, 176, 80)
                    End With
                End If
            ctr = ctr + Len(stxt) + 1
            Next
            Cells(ii, "j") = ctrCode
        ii = ii + 1
        Next
    End With
    Set dic = Nothing
    With Application
        .ScreenUpdating = True
    End With
    MsgBox "done"
    End Sub
    I appreciate any help that can be provided.

    Missit
    Last edited by alansidman; 07-06-2016 at 09:53 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Help modify existing code to include next page down in a sheet.
    By ElmerFud in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-18-2015, 01:04 PM
  2. Modify existing code to save as pdf at page breaks and rename as per cell value
    By byfield8 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2015, 11:58 AM
  3. [SOLVED] Modify existing Code.
    By JO505 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2014, 05:26 PM
  4. [SOLVED] Help modify existing Copy-Paste code
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-11-2014, 10:03 AM
  5. [SOLVED] Modify Existing Mbr Code to Save to Ext.Workbook
    By Miskondukt in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 03-06-2013, 02:36 PM

Tags for this Thread

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