sydinstaller
New Member
- Joined
- Aug 26, 2010
- Messages
- 23
Hi,
This is a tricky one to try explain, but here we go...
Usefully background info:
Following on from this post: http://www.mrexcel.com/forum/showthread.php?t=491155&highlight=RS232IP
My sheets have become much more complex and repetitive than I ever expected.
What I would like to do is:
Copy the data from between the "" in column A (Column F shows example results)
Take the data from the BLUE cell in column A and add it to the cells below it (Column G shows example results) Then at the next BLUE cell start the cycle again.
There are some GREY cells. These are not implemented so they can be ignored but it is OK if they are processed.
I need this to repeat down the entire column.
Then if possible (This is not required as I can run a separate command manually) I would like to run the RS232IP2 script in column H.
Thanks in advance.
Daniel
Here is the code for RS232IP2
This is a tricky one to try explain, but here we go...
Usefully background info:
Following on from this post: http://www.mrexcel.com/forum/showthread.php?t=491155&highlight=RS232IP
My sheets have become much more complex and repetitive than I ever expected.
What I would like to do is:
Copy the data from between the "" in column A (Column F shows example results)
Take the data from the BLUE cell in column A and add it to the cells below it (Column G shows example results) Then at the next BLUE cell start the cycle again.
There are some GREY cells. These are not implemented so they can be ignored but it is OK if they are processed.
I need this to repeat down the entire column.
Then if possible (This is not required as I can run a separate command manually) I would like to run the RS232IP2 script in column H.
Thanks in advance.
Daniel
Here is the code for RS232IP2
Code:
Function RS232IP2(s As String, Optional delim As String = " ") As String ' The usage would be RS232IP2(cell to change, OPTIONAL delimiter as cell referance)
Dim byt() As Byte
Dim j As Long
Const HEADER As String = "49 53 43 50 00 00 00 10 00 00 00 ## 01 00 00 00" ' This is the HEADDER. ## is the section where LEN calculated and is placed
RS232IP2 = Replace(Replace(HEADER, "##", Right("0" & Hex(Len(s) + 1), 2)), " ", delim)
byt = StrConv(s, vbFromUnicode)
For j = 0 To Len(s) - 1
RS232IP2 = RS232IP2 & delim & Hex(byt(j))
Next j
End Function
' Thank you to PGC01 and sandeep.warrier from the MREXCEL forums for providing this script.
' http://www.mrexcel.com/forum/showthread.php?t=491155&highlight=RS232IP
' Original code before I messed with it :)
' Function RS232IP(s As String, HEADER As String, Optional delim As String = " ") As String
' Dim j As Long
'
' RS232IP = Replace(Replace(HEADER, "##", Right("0" & Hex(Len(s) + 1), 2)), " ", delim)
'
' For j = 1 To Len(s)
' RS232IP = RS232IP & delim & Hex(Asc(Mid(s, j, 1)))
' Next j
'End Function
Last edited: