ebea
Active Member
- Joined
- Jul 12, 2008
- Messages
- 296
- Office Version
- 2021
- Platform
- Windows
Hi all. A mystery for me, to have info to fill into a second UserForm, called from a Button on the main userForm.
I have a functioning UserForm, which are loaded from a workbook load event. It have many TexBoxes and one Picture form. All that works perfectly, with the following code, (which are only a part of the whole load code).
Private Sub CommandButton1_Click()
Dim rws As Long, Box As String, LstRw As Long, Sh As Worksheet
Set Sh = Sheets("marklin")
Box = TextBox14.Value
With Sh
LstRw = .Cells(.Rows.Count, "B").End(xlUp).Row
For rws = 3 To LstRw
If .Range("B" & rws).Value = Box Then
TextBox2.Value = .Range("B" & rws).Value
TextBox1.Value = .Range("T" & rws).Value
Image1.Picture = LoadPicture(("F:\tog\pdf\digital\") & Range("T" & rws).Value)
End If
Next rws
End With
I then have insert a new Comman Button on the original UserForm, from where I want to call the new UserForm, and in reality load nearly same info, and from same Sheet, as the other TextBoxes are loaded from.
And it's her my problem are. No matter what I try of code combinations, nothing will be loaded into the new UserForm.
For me, it's like that I can't get focus from the Sheet where the data should be loaded from.
In reality, I should could use the same code, as listed above; but it also not works.
Are there a kind person, who have "the wise Stones"!
Thanks
I have a functioning UserForm, which are loaded from a workbook load event. It have many TexBoxes and one Picture form. All that works perfectly, with the following code, (which are only a part of the whole load code).
Private Sub CommandButton1_Click()
Dim rws As Long, Box As String, LstRw As Long, Sh As Worksheet
Set Sh = Sheets("marklin")
Box = TextBox14.Value
With Sh
LstRw = .Cells(.Rows.Count, "B").End(xlUp).Row
For rws = 3 To LstRw
If .Range("B" & rws).Value = Box Then
TextBox2.Value = .Range("B" & rws).Value
TextBox1.Value = .Range("T" & rws).Value
Image1.Picture = LoadPicture(("F:\tog\pdf\digital\") & Range("T" & rws).Value)
End If
Next rws
End With
I then have insert a new Comman Button on the original UserForm, from where I want to call the new UserForm, and in reality load nearly same info, and from same Sheet, as the other TextBoxes are loaded from.
And it's her my problem are. No matter what I try of code combinations, nothing will be loaded into the new UserForm.
For me, it's like that I can't get focus from the Sheet where the data should be loaded from.
In reality, I should could use the same code, as listed above; but it also not works.
Are there a kind person, who have "the wise Stones"!
Thanks