remove " and concatenate on cell colour and run RS232IP2

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

Excel Workbook
ABCDEFGH
1"RES" - Monitor Out ResolutionRES
2"00"sets ThroughYesYes00!1RES0049 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 52 45 53 30 30
3"01"sets Auto(HDMI Output Only)YesYes01!1RES0149 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 52 45 53 30 31
4"02"sets 480pYesYes02!1RES0249 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 52 45 53 30 32
5"03"sets 720pYesYes03!1RES0349 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 52 45 53 30 33
6"UP"sets Monitor Out Resolution Wrap-Around UpYesYesUP!1RESUP49 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 52 45 53 55 50
7"QSTN"gets The Monitor Out ResolutionYesYesQSTN!1RESQSTN49 53 43 50 00 00 00 10 00 00 00 0A 01 00 00 00 21 31 52 45 53 51 53 54 4E
8"ISF" - ISF ModeISF
9"00"sets ISF Mode CustomNoNo00!1ISF0049 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 49 53 46 30 30
10"01"sets ISF Mode DayNoNo01!1ISF0149 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 49 53 46 30 31
11"VWM" - Video Wide ModeVWM
12"00"sets AutoYesYes00!1VWM0049 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 56 57 4D 30 30
13"01"sets 4:3YesYes01!1VWM0149 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 56 57 4D 30 31
14"05"sets Smart ZoomNoNo05!1VWM0549 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 56 57 4D 30 35
15"UP"sets Video Zoom Mode Wrap-Around UpYesYesUP!1VWMUP49 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 56 57 4D 55 50
16"QSTN"gets Video Zoom ModeYesYesQSTN!1VWMQSTN49 53 43 50 00 00 00 10 00 00 00 0A 01 00 00 00 21 31 56 57 4D 51 53 54 4E
17"VPM" -Video Picture ModeVPM
18"00"sets ThroughYesYes00!1VPM0049 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 56 50 4D 30 30
19"01"sets CustomYesYes01!1VPM0149 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 56 50 4D 30 31
20"02"sets CinemaYesYes02!1VPM0249 53 43 50 00 00 00 10 00 00 00 08 01 00 00 00 21 31 56 50 4D 30 32
Sheet1


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:

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,224,584
Messages
6,179,691
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top