Hi
I have starting number 0 and max number 3.
After pressing Start system will start adding 0,25 until total sum is 3, then system stops working.
Do to it, I used LOOP and as I didn't know how to do it simply I used following logic -
Add 0,25 to into first cell
Add 0,25 to next free cell (ActiveCell.Offset(1, 0).Select)
etc
As I added additional values into first column than I added to into cell B1 formula =SUM(A:A)
So shortly code I used for Looping is following:
Everything is fine (I works quick and it is not a problem). But now I want to show so called log file to user.
It should start with sentence: Calculation started, then I should see step-by-step adding this 0,25 and when 3 is reach there should be showed Calculation finished.
I used very ugly solution (at least I think so my self) - I copied into one cell in Excel text what I want to show as log file. Then made new userForm in VBA, added there textbox without editing option and chose value to be displayed from one excel sheet.
Why I don't like this solution is that currently in this example I have few lines and it is simple to drag them together into one cell in excel cell. But if loop result would be longer than I would have problems. Also this solution what I used is not dynamical - I can't just change Max_Value and then keep using file. I need to go and update also this one excel cell formula.
As I haven't come up with better solution for Loop command to be able to get any data for logging than question is - How to show in text box those calculation steps?. I understand there should be some kind of dynamical solution where start and end labels are fixed and than with dynamical formula middle part will be added, something like that:
How put together such log file?
I have starting number 0 and max number 3.
After pressing Start system will start adding 0,25 until total sum is 3, then system stops working.
Do to it, I used LOOP and as I didn't know how to do it simply I used following logic -
Add 0,25 to into first cell
Add 0,25 to next free cell (ActiveCell.Offset(1, 0).Select)
etc
As I added additional values into first column than I added to into cell B1 formula =SUM(A:A)
So shortly code I used for Looping is following:
Code:
Do
If Sheets("Sheet4").Range("B1") >= Max_Value Then Exit Do
ActiveCell.Value = Add_Value
ActiveCell.Offset(1, 0).Select
Loop
Everything is fine (I works quick and it is not a problem). But now I want to show so called log file to user.
It should start with sentence: Calculation started, then I should see step-by-step adding this 0,25 and when 3 is reach there should be showed Calculation finished.
I used very ugly solution (at least I think so my self) - I copied into one cell in Excel text what I want to show as log file. Then made new userForm in VBA, added there textbox without editing option and chose value to be displayed from one excel sheet.
Why I don't like this solution is that currently in this example I have few lines and it is simple to drag them together into one cell in excel cell. But if loop result would be longer than I would have problems. Also this solution what I used is not dynamical - I can't just change Max_Value and then keep using file. I need to go and update also this one excel cell formula.
As I haven't come up with better solution for Loop command to be able to get any data for logging than question is - How to show in text box those calculation steps?. I understand there should be some kind of dynamical solution where start and end labels are fixed and than with dynamical formula middle part will be added, something like that:
Code:
TextBox1.Value = Sheets("Sheet4").Range("e2") & [i]Dynamical part[/i] & Sheets("Sheet4").Range ("e2")
How put together such log file?