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
CodePHP Code:
84,10789393,18-04-2015 12:59:45.393,0500AB888E,677
Thanks for the help.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(Buffer, vbCrLf)
If CRLFPos > 0 Then
MyData = Mid(Buffer, 1, CRLFPos - 1)
Buffer = Mid(Buffer, CRLFPos + 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 f = LBound(arr) To UBound(arr)
c.Offset(0, f) = arr(f)
Next f
Next c
Range("A3000").End(xlUp).Select
End If
End Sub
Bookmarks