+ Reply to Thread
Results 1 to 3 of 3

Reading a serial port delimited string into rows

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

    Reading a serial port delimited string into rows

    Hi,

    I've got this problem reading a comma delimited string from a serial port into rows. If the worksheet is the active everything works like expected, if you go to another sheet while still receiving serial data the complete delimited string gets "stuck" on the first cell and will only dissipates to other cell when the worksheet is active and the next string is read.

    Serial String
    PHP Code: 
    84,10789393,18-04-2015 12:59:45.393,0500AB888E,677 
    Code

    PHP Code: 
    Private Sub GetData()

    Static 
    Buffer As String
    Dim strArray
    () As String
    Dim intCount 
    As Integer
    Dim CRLFPos 
    As Integer
    Dim MyData 
    As String
    Dim c 
    As Range
    Dim f 
    As Long 
    Dim arr 
    As Variant

    Buffer 
    Buffer SComm1.Input 

    CRLFPos 
    InStr(BuffervbCrLf

    If 
    CRLFPos 0 Then

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

       Sheets
    ("Logger").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","

          For 
    LBound(arrTo UBound(arr)

                
    c.Offset(0f) = arr(f)
       
            
    Next f
        Next c
     Range
    ("A3000").End(xlUp).Select

      End 
    If

    End Sub 
    Thanks for the help.
    Last edited by land35; 04-18-2015 at 08:57 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Reading a serial port delimited string into rows

    The range in the below line of code refers to activesheet since it is not referred to any specific sheet

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

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

    Re: Reading a serial port delimited string into rows

    Quote Originally Posted by :) Sixthsense :) View Post
    The range in the below line of code refers to activesheet since it is not referred to any specific sheet

    Please Login or Register  to view this content.

    That simple..this has the desired affect.
    PHP Code: 
    Sheets("Logger").Range("A1:A" Sheets("Logger").Range("A" Rows.Count).End(xlUp).Row
    Thanks Sixthsense for the pointer.

+ 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. Need to output to serial port if string in column is duplicated.
    By MikeHaras in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-23-2013, 03:45 AM
  2. excell data through com serial port
    By razfartan in forum Excel General
    Replies: 1
    Last Post: 01-24-2013, 05:08 AM
  3. [SOLVED] q:read value from serial port
    By qwerty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-28-2005, 01:57 AM
  4. [SOLVED] serial port or messaging
    By Kilo Bravo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-06-2005, 01:06 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