Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6962811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:42:30+00:00 2026-05-27T15:42:30+00:00

Sub Parse() Workbooks.OpenText Filename:=C:\Users\karthic.rangaraj\Desktop\4401.csv ‘ Parse it using comma and semicolon as delimiters Range(Range(A1),

  • 0
    Sub Parse()


        Workbooks.OpenText Filename:="C:\Users\karthic.rangaraj\Desktop\4401.csv"

         ' Parse it using comma and semicolon as delimiters
        Range(Range("A1"), Range("A1").End(xlDown)).TextToColumns _
        DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=True, Comma:=True, Space:=False, Other:=False, _
        FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 1), Array(5, 2))


        Range("B:B,D:D").Delete
         'Range("D1").FormulaR1C1 = "Application_ID"

         Dim lLR As Long
    Dim vArray As Variant
    Dim sString As String
     '*****************************************************************************************
     'Add as many items you like to this array
     '*****************************************************************************************
    vArray = Array("Windows XP", "Adobe", "IBM", "VLC", "PDFCreator", "Sonic", "Office", "Sigamtel", "Printer")
    For i = LBound(vArray) To UBound(vArray)
        sString = sString & Chr(34) & vArray(i) & Chr(34) & ","
    Next i
     '*****************************************************************************************
     'This is the final array string that we pass to array formula
     '*****************************************************************************************
    sString = "{" & Left(sString, Len(sString) - 1) & "}"
    lLR = Range("A" & Rows.Count).End(xlUp).Row
    Range("D2").FormulaArray = "=INDEX(" & sString & ",1,MATCH(1,--ISNUMBER(SEARCH(" & sString & ",$C2,1)),0))"


    Range("D2").AutoFill Destination:=Range("D2:D" & lLR)
ActiveWorkbook.SaveAs "C:\Users\karthic.rangaraj\Desktop\4401.xls", FileFormat:=56
' 52 = xlOpenXMLWorkbookMacroEnabled = xlsm (workbook with macro's in 2007)

    End Sub

I can save this single file as .xls file using this code

  ActiveWorkbook.SaveAs "C:\Users\karthic.rangaraj\Desktop\4401.xls", FileFormat:=56
    ' 52 = xlOpenXMLWorkbookMacroEnabled = xlsm (workbook with macro's in 2007)

Here are my questions:

  1. How can i access a bunch of CSV files in a folder C:\Users\karthic.rangaraj\Desktop\CSVFiles
    & Save it as a XLS file in the same folder after the process is done in the same file names using VBA?

  2. I have a problem in the array:

Code:

vArray = Array("Windows XP", "Adobe", "IBM", "VLC", ".Net Framework", "Office", "Java", "Windows Media", "J2SE", "MSXML")
        For i = LBound(vArray) To UBound(vArray)
            sString = sString & Chr(34) & vArray(i) & Chr(34) & ","
        Next i

sString = "{" & Left(sString, Len(sString) - 1) & "}"
lLR = Range("A" & Rows.Count).End(xlUp).Row
Range("D2").FormulaArray = "=INDEX(" & sString & ",1,MATCH(1,--ISNUMBER(SEARCH(" & sString & ",$C2,1)),0))"
Range("D2").AutoFill Destination:=Range("D2:D" & lLR)

if enter more than 10 items (let’s say 14) i’m getting this error message:

Unable to set the property of the class range FormulaArray

What’s wrong with the array formula here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:42:31+00:00Added an answer on May 27, 2026 at 3:42 pm

    So whats wrong with this simpler formula?

    vArray = Array("Windows XP", "Adobe", "IBM", "VLC", ".Net Framework", "Office", "Java", "Windows Media", "J2SE", "MSXML")
            For i = LBound(vArray) To UBound(vArray)
                sString = sString & Chr(34) & vArray(i) & Chr(34) & ","
            Next i
    
    sString = "{" & Left(sString, Len(sString) - 1) & "}"
    lLR = Range("A" & Rows.Count).End(xlUp).Row
    Range("D2").Formula = "=HLOOKUP($C2," & sString & ",1,FALSE)"
    Range("D2").AutoFill Destination:=Range("D2:D" & lLR)
    

    EDIT:

    OK Now I understand what you are trying to do: try this code

    Sub Joe()
    vArray = Array("Windows XP", "Adobe", "IBM", "VLC", ".Net Framework", "Office", "Java", "Windows Media", "J2SE", "MSXML")
            For i = LBound(vArray) To UBound(vArray)
                sstring = sstring & Chr(34) & vArray(i) & Chr(34) & ","
            Next i
    sstring = "{" & Left(sstring, Len(sstring) - 1) & "}"
    lLR = Range("A" & Rows.Count).End(xlUp).Row
    Range("E2").Formula = "=InList($C2," & sstring & ")"
    Range("E2").AutoFill Destination:=Range("E2:E" & lLR)
    End Sub
    Function InList(theCell As Range, theList As Variant)
        Dim j As Long
        Dim str As String
        InList = CVErr(xlErrNA)
        str = UCase(Trim(CStr(theCell)))
        For j = LBound(theList) To UBound(theList)
            If str Like UCase("*" & theList(j) & "*") Then
                InList = theList(j)
                Exit For
            End If
        Next j
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse specific XML file which is located in sub directories
I'd like to be able to use ruby's OptionParser to parse sub-commands of the
Using sub prototypes, we can define our own subs that look like map or
I'm using VBA to parse the soap xml with MSXML2 and XPath but while
If I pass a hash to a sub: parse(\%data); Should I use a variable
I parse message data into a CSV file via Outlook rules. How can I
module.pm package module; use 5.012; use warnings; sub Parse { return 1; } 1;
I'm trying to parse JSON in android but am having trouble with accessing sub
I need to parse files generated by a third-party application. Using ANTLR, I have
I'm trying to parse some data out of a file using Perl & Parse::RecDescent.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.