excelenergy
Board Regular
- Joined
- Jun 7, 2012
- Messages
- 142
Hello,
I got fairly easy problem one of you may know the answer too. I just couldn't figure out.
I have a userform, when its triggered, text boxes get populated. The data in the text boxes are coming from cell values in another sheet.
However when I execute my Macro in the other sheet where the values are, the text boxes load up.
When I execute my Macro in the sheet its supposed to be executed in. The text boxes don't load up.
Any idea why this is? Id like to change the syntax so its point at the right sheet, but everything Ive tried doesn't work, here is an example
I got fairly easy problem one of you may know the answer too. I just couldn't figure out.
I have a userform, when its triggered, text boxes get populated. The data in the text boxes are coming from cell values in another sheet.
However when I execute my Macro in the other sheet where the values are, the text boxes load up.
When I execute my Macro in the sheet its supposed to be executed in. The text boxes don't load up.
Any idea why this is? Id like to change the syntax so its point at the right sheet, but everything Ive tried doesn't work, here is an example
Code:
Sub LoadBoxes()
'/// if you use a With Statement then the control needs prefixing with .
With Me
Worksheets("Sheet1 (4)").txtNumber.Value = Cells(currentrow, 1).Text
.txtName.Value = Cells(currentrow, 2).Text
.TextBox1.Value = Cells(currentrow, 6).Text
.TextBox2.Value = Cells(currentrow, 5).Text
.txtCreator.Value = Cells(currentrow, 7).Text
.txtOwner.Value = Cells(currentrow, 3).Text
.txtYears.Value = Cells(currentrow, 10).Text
.ListBox1.Value = Cells(currentrow, 8).Text
.TextBox3.Value = Cells(currentrow, 9).Text
End With
End Sub