+ Reply to Thread
Results 1 to 8 of 8

Split macro no longer working

  1. #1
    Registered User
    Join Date
    11-20-2017
    Location
    Harrisburg, PA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    56

    Split macro no longer working

    I have the following macro that I have been using successfully. When I tried to use it today I received the following error (Compile Error: Wrong number of arguments or invalid property assignment) at Split on the line myarray = Split(Lstring, "-")

    I have spent hours researching and tweaking my code but it continues to fail in the same place and I have no idea why since it worked previously.

    I am trying to take text from Column C rows and split it at the dashes into a total of 3 columns (C, D, E).

    Your help would be greatly appreciated.

    Sub Splitstring()

    Dim Lstring As String
    Dim myarray() As String

    For a = 2 To 2500

    Lstring = Worksheets("Sheet1").Cells(a, 3).Value
    myarray = Split(Lstring, "-")

    For I = 0 to UBound(myarray)

    Worksheets("Sheet1").cells(a, i + 3).Value = myarray(i)

    Next
    Next

    End Sub

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: Split macro no longer working

    Works fine for me, check that you don't have any macros, variables, functions etc called Split

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,498

    Re: Split macro no longer working

    Work fine for me also. Re-worked it. Should not make a difference but who knows.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-20-2017
    Location
    Harrisburg, PA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    56

    Re: Split macro no longer working

    Thank you so much for your reply. I DID have a macro called Split. I renamed the macro and it works like a charm now.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: Split macro no longer working

    Glad it's sorted & thanks for the feedback.

    It's always best avoid using Keywords as procedure names, variables etc as it can cause problems such as this.

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Split macro no longer working

    @ Fluff13,

    Please stop being so damn Good!

    If you don't watch it, I shall have to add you to my list of "enemies", like: Arkadi, xladept, bakerman2, Olly, Karedog, Kaper, Logit, AB33, Davexcel, etc., etc.!

    When they see my name, they all shiver with fear, stutter, and speak in Capital Letters.

    Kind regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: Split macro no longer working

    Quote Originally Posted by Winon View Post
    When they see my name, they all shiver with fear, stutter, and speak in Capital Letters.
    And there was me thinking that they were simply rolling around the floor in hysterics

    Thanks for the Rep & the kind words.

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Split macro no longer working

    Oops!

    That Rep was done in a moment of weakness!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copied working macro to new workbook, but no longer working
    By twisted31 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-23-2017, 06:17 PM
  2. Macro No Longer Working
    By ukbumpkin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2016, 11:04 AM
  3. Worksheet change macro no longer working
    By burny888 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-11-2016, 08:38 AM
  4. Query on VBA macro no longer working
    By stephen.m.brown in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-25-2013, 12:12 PM
  5. [SOLVED] Macro no longer working?
    By Margate in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2013, 02:26 PM
  6. Macro no longer working - Don Guillett
    By tanyhart in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-11-2006, 01:10 PM
  7. [SOLVED] Help: Excel 4 macro suddenly no longer working
    By Keske Saram in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-03-2005, 10: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