New UserForm fill

ebea

Active Member
Joined
Jul 12, 2008
Messages
296
Office Version
  1. 2021
Platform
  1. 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
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
This is correct code and should work for itself, but there can be many reasons that confuses code.
Try this...
1. When you switching between few UserForms always put name of the of the correct UserForm before name of the control.
2. Take care that declarations exists in the each UserForm.
3. Check names of each control.
4. If you have many procedures in one module, be sure some control not have open empty duplicate code.
 
Last edited:
Upvote 0
This is correct code and should work for itself, but there can be many reasons that confuses code.
Try this...
1. When you switching between few UserForms always put name of the of the correct UserForm before name of the control.
2. Take care that declarations exists in the each UserForm.
3. Check names of each control.
4. If you have many procedures in one module, be sure some control not have open empty duplicate code.
I tried many combinations, and code pieces, but still without any luck. I simply run out of ideas, and can't find the solution. My second Form loads fine, and the code showed up, works without any errors. I even tested with a TextBox to be equal to TextBox on the other Form, but still no data are filled in!
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,755
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top