finaljustice
Board Regular
- Joined
- Oct 6, 2010
- Messages
- 175
Hello,
I am creating a userform to manipulate a sheet and expose only some information of the sheet to the user.
Basically I have a cell, on this example A1, where it is supposed to be a temperature and that temperature will affect many other calculations on the sheet (for simplification the example placed here doesn't involve the complete sheet with calculations).
This temperature must vary between 1600ºC and 1800ºC and must be displayed and altered on a userform textbox an cells.
I came up with this code:
On this example above I am having issues, since I am only being able to increase the temperature. I therefore realized that the reason must be:
On the other hand, if I place the value for the minimum at 1600, then when ever I click on the button, the textbox resets to that minimum. I don't want that, I would like the value to be the one that was last used/calculated on the spreadsheet cell A1, because that would "reset" all the other calculations that would be dependent on this cell.
Could someone help we with this, I think the solution must be simple, I'm just not getting the logic of how to make it behave as I want it.
Thanks for your attention
Yours sincerely.
Luis
I am creating a userform to manipulate a sheet and expose only some information of the sheet to the user.
Basically I have a cell, on this example A1, where it is supposed to be a temperature and that temperature will affect many other calculations on the sheet (for simplification the example placed here doesn't involve the complete sheet with calculations).
This temperature must vary between 1600ºC and 1800ºC and must be displayed and altered on a userform textbox an cells.
I came up with this code:
Code:
Private Sub UserForm_Initialize()UserForm1.TextBox1 = ThisWorkbook.Sheets(1).Range("A1")
End Sub
Code:
Private Sub ScrollBar1_Change()
[FONT=arial]'the idea here is to be able to vary between 1600ºC and 1800ºC freely, and always start from what is on cell A1, and when altered, cell A1 will be altered as well...[/FONT]
With ScrollBar1
.Min = UserForm1.TextBox1
.Max = 1850
.LargeChange = 50
.SmallChange = 1
'.Value = UserForm1.TextBox1
End With
Sheets(1).Range("A1").Value = ScrollBar1.Value
UserForm1.TextBox1 = Sheets(1).Range("A1")
End Sub
On this example above I am having issues, since I am only being able to increase the temperature. I therefore realized that the reason must be:
Code:
.min = Userform1.Textbox1
On the other hand, if I place the value for the minimum at 1600, then when ever I click on the button, the textbox resets to that minimum. I don't want that, I would like the value to be the one that was last used/calculated on the spreadsheet cell A1, because that would "reset" all the other calculations that would be dependent on this cell.
Could someone help we with this, I think the solution must be simple, I'm just not getting the logic of how to make it behave as I want it.
Thanks for your attention
Yours sincerely.
Luis