cajunman64
New Member
- Joined
- Sep 20, 2018
- Messages
- 1
I am looking to create a vba in excel that will look at Column B and E and copy the next duplicate data to the next column and than repeat the program until all duplicate data been copy. Note we have a trending software that will export data to a .csv file....it adds all the sensors data to column C (xxxx.xx),it adds all the sensors name to column B (DHPT-PT1.ActiveReadValue), it adds all the Dates to column D and all the time to column E.
Example:
A B c D E
[TABLE="width: 760"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Trend File[/TD]
[TD] Tag Name[/TD]
[TD] Tag Value[/TD]
[TD] Tag Timestamp (Date)[/TD]
[TD] Tag Timestamp (Time)[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9189.453125[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]29:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9190.800781[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]30:59.4[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9193.142578[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]31:59.5[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9191.109375[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]32:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9192.280273[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]33:59.7[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 760"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8353.460938[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]29:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8355.167969[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]30:59.4[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8357.449219[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]31:59.5[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8358.40332[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]32:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8356.188477[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]33:59.7[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 760"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9187.732422[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]29:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9189.123047[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]30:59.4[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9191.445313[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]31:59.5[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9189.433594[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]32:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9190.560547[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]33:59.7[/TD]
[/TR]
</tbody>[/TABLE]
Looking to copy DHPT-PT1 data with date and time to a new workbook or the same csv file but to a different sheet in column A2 starting Date, B2 Starting Time, Column C2 Starting DHPT1 Values, Column D2 starting DHPT2 Values, and E2 starting DHPT3 values
Column A Column B Column C Column D Column E
1) Date Time DHPT-PT1 DHPT-PT2 DHPT-PT3
2) 9/19/18 29:59.6 9189.453125 8353.460938 9187.732422
3) 9/19/18 30:59.4 9190.800781 8355.167969 9189.123047
4) 9/19/18 31:59.5 9193.142578 8357.449219 9191.445313
5) 9/19/18 32:59.6 9191.109375 8358.40332 9189.433594
6) 9/19/18 33:59.7 9192.280273 8356.188477 9190.560547
Thanks for the help
Example:
A B c D E
[TABLE="width: 760"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Trend File[/TD]
[TD] Tag Name[/TD]
[TD] Tag Value[/TD]
[TD] Tag Timestamp (Date)[/TD]
[TD] Tag Timestamp (Time)[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9189.453125[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]29:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9190.800781[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]30:59.4[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9193.142578[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]31:59.5[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9191.109375[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]32:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT1.ActiveReadValue[/TD]
[TD="align: right"]9192.280273[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]33:59.7[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 760"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8353.460938[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]29:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8355.167969[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]30:59.4[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8357.449219[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]31:59.5[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8358.40332[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]32:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT2.ActiveReadValue[/TD]
[TD="align: right"]8356.188477[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]33:59.7[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 760"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9187.732422[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]29:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9189.123047[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]30:59.4[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9191.445313[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]31:59.5[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9189.433594[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]32:59.6[/TD]
[/TR]
[TR]
[TD]Test1.tvw[/TD]
[TD]DHPT-PT3.ActiveReadValue[/TD]
[TD="align: right"]9190.560547[/TD]
[TD="align: right"]9/19/18[/TD]
[TD="align: right"]33:59.7[/TD]
[/TR]
</tbody>[/TABLE]
Looking to copy DHPT-PT1 data with date and time to a new workbook or the same csv file but to a different sheet in column A2 starting Date, B2 Starting Time, Column C2 Starting DHPT1 Values, Column D2 starting DHPT2 Values, and E2 starting DHPT3 values
Column A Column B Column C Column D Column E
1) Date Time DHPT-PT1 DHPT-PT2 DHPT-PT3
2) 9/19/18 29:59.6 9189.453125 8353.460938 9187.732422
3) 9/19/18 30:59.4 9190.800781 8355.167969 9189.123047
4) 9/19/18 31:59.5 9193.142578 8357.449219 9191.445313
5) 9/19/18 32:59.6 9191.109375 8358.40332 9189.433594
6) 9/19/18 33:59.7 9192.280273 8356.188477 9190.560547
Thanks for the help