+ Reply to Thread
Results 1 to 3 of 3

Spliting coma delimited string running slow.

  1. #1
    Registered User
    Join Date
    02-28-2014
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    8

    Spliting coma delimited string running slow.

    Hi, I have some data coming through a serial port that gets inserted into separate columns, the whole things looks physically slow, anyone see a problem with the code?



    PHP Code: 
    Private Sub GetData()

    Static 
    Buffer As String
    Dim CRLFPos 
    As Integer
    Dim MyData 
    As String
    Dim arr 
    As Variant
    Dim c 
    As Range
     Dim f 
    As Long  ' variable to iterate over the arr

    Buffer = Buffer & SComm1.Input 

    CRLFPos = InStr(Buffer, vbCrLf)   '
    use vbCr,(vbCrLf) if only a carriage return is usedbut I suspect vbCrLf is correct


    If CRLFPos 0 Then

    MyData 
    Mid(Buffer1CRLFPos 1)
    Buffer Mid(BufferCRLFPos 2)
    SComm1.InputLen 0

       Sheet1
    .Range("A" Rows.Count).End(xlUp).Offset(1).Value MyData

       
    For Each c In Range("A1:A" Range("A" Rows.Count).End(xlUp).Row)
     

            
    arr Split(c","' chr(32) is a space
             For f = LBound(arr) To UBound(arr)
            c.Offset(0, f) = arr(f)

            Next f
        Next c
       

      End If
    End Sub 

  2. #2
    Forum Contributor
    Join Date
    03-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    491

    Re: Spliting coma delimited string running slow.

    Application.ScreenUpdating = False ???

  3. #3
    Registered User
    Join Date
    02-28-2014
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Spliting coma delimited string running slow.

    Quote Originally Posted by swade730 View Post
    Application.ScreenUpdating = False ???
    A quick test shows a improvement on visible speed, not sure why that should make a difference.

+ 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. coma delimited data in rows, Help
    By jayeomer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2014, 04:46 PM
  2. [SOLVED] HELP: spliting a string
    By gtben in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-02-2013, 12:53 PM
  3. Macro is running real slow and makes navigating the worksheet really slow after execution.
    By MichWolverines in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2013, 04:29 PM
  4. Macro to hide/unhide cells not running or running slow
    By mbp727 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2013, 04:22 PM
  5. [SOLVED] Count numbers between two values in a coma delimited string of numbers
    By van23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-10-2012, 11:42 PM
  6. Spliting Portuguese Address String into three cells
    By Dabbot in forum Excel General
    Replies: 1
    Last Post: 08-03-2012, 04:46 PM
  7. Replies: 1
    Last Post: 07-30-2010, 01:58 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