Results 1 to 6 of 6

Macro Error, can't locate problem

Threaded View

  1. #1
    Registered User
    Join Date
    03-05-2015
    Location
    Michigan
    MS-Off Ver
    2007
    Posts
    6

    Macro Error, can't locate problem

    New Here and I need some help.

    I had a friend create a program and it has worked perfectly for a while. Now I am having issues with it and can't get in contact with him. The program looks a values in Column A, and if find finds the value in Column B and combines them into a cell with a delimiter of ";" (semicolon). I have a set of data that it will not do this for, it keeps giving me a Runtime Error '13', type mismatch.


    As I said this is over my head, here is the code that he created. The line in bold is where the debug says the issue is. I have searched and searched and can't find the problem.

    _____________________________________________________________________________________
    Sub CombineAndConcatenate()
    
    
    Application.ScreenUpdating = False
    
    
    '***WORKS ASSUMING DATA THAT IS TO BE COMBINED / CONCATENATED IS IN COLUMNS A & B***
    
    
    'declare variables
    Dim dc As Object
    Dim inputArray As Variant
    Dim i As Integer
    Dim x As Long
    
    'find last row of reference column
    x = Range("A" & Rows.Count).End(xlUp).row
    
    'set / define data to use
    Set dc = CreateObject("Scripting.Dictionary")
    inputArray = WorksheetFunction.Transpose(Range("A2:B" & x).Value)
    
    
    'run through data and combine
    For i = LBound(inputArray, 2) To UBound(inputArray, 2)
    If Not dc.Exists(inputArray(1, i)) Then
    dc.Add inputArray(1, i), inputArray(2, i)
    Else
    dc.Item(inputArray(1, i)) = dc.Item(inputArray(1, i)) & "," & inputArray(2, i)
    End If
    Next i
    
    
    'output to sheet
    Range("C2").Resize(UBound(dc.keys) + 1) = Application.Transpose(dc.keys)
    Range("D2").Resize(UBound(dc.items) + 1) = Application.Transpose(dc.items)
    
    
    Set dc = Nothing
    
    
    Application.ScreenUpdating = True
    
    
    End Sub
    _____________________________________________________________________________________

    Attached is the list I am working with.


    Please any help is appreciated.
    Attached Files Attached Files
    Last edited by group-am; 03-05-2015 at 04:07 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro to locate locate text string and copy/paste offset range
    By guystanley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-16-2014, 08:46 PM
  2. [SOLVED] Run-time error '-2147467259 (80004005)' / unable to locate problem
    By Lloyd Blankfein in forum Access Programming / VBA / Macros
    Replies: 18
    Last Post: 08-06-2013, 12:58 PM
  3. Problem with web query, cannot locate server error
    By batjl9 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2011, 01:52 PM
  4. how to use find function to locate error cells?
    By perfection in forum Excel General
    Replies: 1
    Last Post: 10-24-2010, 10:52 PM
  5. Outlook Automation Error Problem - Can't locate Outlook Module
    By Allan P. London in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2005, 06:05 PM

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