Com/Serial Port to Excel

  • i come across this and works well for getting data from my scale but have a few questions if someone might can help me

    1) I need help getting so that when i send the Capture command( AKA Hit the print button ) that it will let me chose which cell that number goes into and not jsut on the next line

    2) how i can regex and have it auto take out the Ibs so its just the number itself

    pike replied with this

    1. [/COLOR][COLOR=blue]If[/COLOR][COLOR=#333333] [/COLOR][COLOR=blue]Not[/COLOR][COLOR=#333333] .Data = vbNullString [/COLOR][COLOR=blue]Then[/COLOR][COLOR=#333333][/COLOR] lngRow = lngRow + 1 Cells(lngRow, 1).Value = replace(.Data,"Ibs","") [COLOR=darkgreen]' change the cell location in the cells function Cells(row,column) and use replace function to remove the Ibs[/COLOR] Range("L7").Value = "Transfer" [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR] [COLOR=#333333]

    [/COLOR]But its still not allowing me to pick the Cell i want the Data too go into next it will still go too the direct one below also in the Replacing Function its working for the most part but here is example of what data is being captured from my scale and sent into excel

    0 KG GR I need to remove any and all items besids the Number so ( ) and (KG GR) Needs too be deleted

    Also every time i click open to have data pulled into excel it will delete the last entries any edit in the code that will stop this from happening ?

  • Re: Com/Serial Port to Excel

    Ok so i have a Worksheet i have attached the worksheet works i just need too add the Serial Data is Captured from the Scale and then using the example you gave for Serial Data worked . what i need it too allow for is that it needs too be able to Click on the Cell i want the data entered into and it grab that set weight from the scale ( Atm it will just add it too A1 then down the line ) need so i can just click the cell i want the data entered into and it enter it in


    • Monday.xlsm

      (19.92 kB, downloaded 476 times, last: )
  • Re: Com/Serial Port to Excel

    Quote from pike;795406

    Hi can use attach ab example of the input stream data?

    i think this is what you are asking for . in the example file the data when the Print Button on the Scale is pressed is entered in on the Line starting With A1 and then just enters downward each time button on scale is pressed A2 A3 A4 BLAHH BLAHH i need so that when i click on a set cell the number captured from the scale goes into that Cell and not the cell next in line ( example : scale button pushed - Have E3 Cell clicked on and the data is entered there then next Scale button pushed i have A7 clicked on and the data goes into that selected Cell )

    the data i receive from the scale is 0 KG GR and need to Regex it down too Just the Number need to Regex out () (KG GR)

  • Re: Com/Serial Port to Excel

    1. lngRow = lngRow + 1
    2. Cells((lngRow + ActiveCell.Row) - 1, (ActiveCell.Column)).Value = Replace(.Data, "KG GR", "")

    Ok so i got this working so far but it will either enter the Data that is coming from Scale in the line below it so many rolls down or so many rolls up ???

    Well i think i may have it working now per this code

    1. lngRow = lngRow
    2. Cells((lngRow + ActiveCell.Row) , (ActiveCell.Column)).Value = Replace(.Data, "KG GR", "")

    But i still have this one issue i can't get this Symbol to Delete like the KG GR

  • Re: Com/Serial Port to Excel

    you can use trim() function to remove the spaces
    also add a start row to P8

  • Re: Com/Serial Port to Excel

    OK i got everything working as i want it too but need help adding a button that sends the p Command to my Scale so that i don't have to push the Printer Button on my scale Every time i want to Capture data from scale

    Would like so that the Connect button will Connect to the Serial Port and Send command to Capture the data so i don't have three buttons any help would be great i have also attached a copy of the worksheet Below as well as a link too it via dropbox thanks…89xi/New%20Test.xlsm?dl=0


    • New Daily.xlsm

      (71.9 kB, downloaded 323 times, last: )
  • Re: Com/Serial Port to Excel

    i have a Transcell TI-500E Device ( which displays the weight from my Scale ) and at this time when i want to capture data from the scale i open the connection to the port then on the device i have to click the ( PRINT ) Button on the Device and it will then send the Data i need sent ( Data being the Weight ) so what i need is help with sending the command form excel button to the serial device on Com1

    Also im not understanding what you mean by Data Sheet on the equipment

  • Re: Com/Serial Port to Excel

    I don't have access to the Transcell TI-500E Device or know what you are asking is possible with it.
    You will have to read the data sheets to see.
    I use the comm port to down load data recorders or total stations.
    With these you have to press send on the machine to download the data.
    With the write it is only to update data lists not to trigger a download.

    You may just have to leave the port open while in use.

  • Re: Com/Serial Port to Excel

    ok is there any way to stop the data from being received ? it will jsut set and send the same data 1000 times + and will never stop unless i close connection

  • Hello,
    I use Mettler XS6002, TE60j scales and W10x64 and Excel 2016.
    Your vba program Excel Serial Comms Class Test allows me to recover the weight value (only numbers) sent from the scale very well with the "PRINT" key into the active cell.
    and move the active cell to the next line and previous column.
    I would like enter a value (number of pieces for example) in the active cell, and retrieve the weight in the next one on the same line and so on for each weighing operation.
    but as soon as I enter a value in the spreadsheet the program no longer responds and I am forced to leave the application.

    would you have a solution?
    thanking you in advance