fumei , remember, you asked for this.
And I did not take any offense at your questioning me, it is just that as far as I know, no one else is using VBA and or VB6 in quite the way I am doing. So, it is a struggle, plus no one to "high 5" with when I do make something work.
I am pooling the info into one textbox because the chlorine feed is in stages from beginning to end. There is cause and effect, if the one that feeds point B fails, then the one at point C better be setting ready to go when its feedback loop reports a low residual. So, they need to see the whole process at one time, not one box for Pre-Chlorine, another for CT values to the Clearwell, and then a third for polishing the water as it leaves.
As I mentioned, water plant. Chemical feeds and dosages are absolutely critical. In water treatment, you are not allowed any "oops". The first bit, the "Concatenate" statment, brings back info about one of the chlorinators. We have 5 chlorinators, they can feed different places in the plant if we so desire. This statement tells the operators what the chlorinator should be doing, as well as tell them what it is doing. What they see is a userform. They click on a "command Button", an input box pops up and asks them how many hours they want info for. They enter a number, click ok. The Historian is searched, the spreadsheet is calculated, then the TextBox tells them what each Chlorinator has been doing for the requested time period.
So from row A22 through row A29, are the "Concatenate" statements.
Then, in Q27 are all of the info from those rows. Then, at the bottom, you can see some of the code I wrote to get the info into a text box. The reason I wanted to print the properties of the text box is so I would have future reference to how I set Autosize, Multiline, Wordwrap, etc.
And, I know that my code is ugly, ungainly, slow, etc, but most of the time, it gets the job done until I can learn better ways of coding.
=(CONCATENATE("7-E-4,RAW WTR DOSAGE,",CHAR(32),FIXED($B$10,2),CHAR(32),"CALC PPD",CHAR(32),FIXED($C$10,0),CHAR(32),"CALC VARIABLE",CHAR(32),FIXED($I$10,2),CHAR(32),CHAR(32),"ACTUAL PPD",CHAR(32),FIXED($F$10,0),CHAR(32),"ACTUAL VARIABLE",CHAR(32),FIXED($J$10,2),CHAR(32),""))
=($A$22) & CHAR(10) & ($A$23) & CHAR(10) & ($A$24) & CHAR(10) & ($A$25) & CHAR(10) & ($A$26) & CHAR(10) & ($A$27) & CHAR(10) & ($A$28)
Private Sub CommandButton1_Click()
Dim MyTime, MyDate, MyStr
Dim MyNum As Range
Set MyDate = Worksheets("Sheet3").Range("S27")
Set MyNum = Worksheets("Sheet3").Range("c1")
MyNum = Application.InputBox("Enter number of hours desired")
Worksheets("Sheet3").Application.Calculate
Worksheets("Sheet3").Range("$G$19").Value = Format(MyDate, "dddd, mmm dd yyyy hh:mm")
Label1.Caption = Now()
Label2.Caption = Worksheets("Sheet3").Range("K6")
Worksheets("Sheet3").Application.Calculate
TextBox1.MultiLine = True
TextBox1.Value = Worksheets("Sheet3").Range("Q27")
TextBox2.MultiLine = True
TextBox2.Value = Worksheets("Sheet3").Range("Q28")
TextBox3.MultiLine = True
TextBox3.Value = Worksheets("Sheet3").Range("Q29")
End Sub