userform not showing data on opening

littlepete

Well-known Member
Joined
Mar 26, 2015
Messages
503
Office Version
  1. 365
Platform
  1. Windows
hello :)
my userform has two buttons PREVIOUS and NEXT to show data from the row before, or the row after the active cell row :)
but: on clicking in my data list to open the userform, it does not show anything, so now i click NEXT and then PREVIOUS and
then i get the data from the active cell row.

this is what i have:

VBA Code:
Private Sub CommandButton13_Click()
Unload Me
ufpersonenfiche.Show ' to show the form with persons' data
End Sub

and:
VBA Code:
Sub pfvolgendepersoon_Click() ' show next row
Dim dezerij As Long
dezerij = ActiveCell.Row + 1
volgenderij:
If Range("bl" & dezerij).Value = "x" Or Range("bl" & dezerij).Value = "o" Then ' if column BL is x/o then skip row
dezerij = dezerij + 1
GoTo volgenderij
End If
Sheets("gegevens").Range("b" & dezerij).Select
ufpersonenfiche.pfnaam.Text = Sheets("gegevens").Range("ak" & dezerij).Value
ufpersonenfiche.pfgeboorte.Text = Sheets("gegevens").Range("q" & dezerij).Value
( ...  => 39 lines to get all the data )

what should i change, to see the data from the active cell row immediately when i open the userform?

thank you for your time !!!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
To have something automatically happen when you open a UserForm you need a script like this in your Userform

VBA Code:
Private Sub UserForm_Initialize()
'Modified  3/6/2022  10:00:49 PM  EDT
TextBox1.Value = Sheets("Alpha").Range("A1").Value
End Sub

This is the important Part:
Private Sub UserForm_Initialize()

Tells the script to run when Userform is opened
Modify other part of script to your need
 
Upvote 0
Solution
Hello :)

again this is something simple, but it needs to be exact... now it's working perfectly :) yeahhh !!!

the only thing i regret is the missing "center text in cell horizontally and vertically" but i found a trick
and i used it for my title :) !!!

sofar al works as it should :) !!! (wish i was 30 years younger so i could learn vba more hahaha)

thank you !!!
 
Upvote 0

Forum statistics

Threads
1,215,419
Messages
6,124,798
Members
449,189
Latest member
kristinh

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