Userform reload on open

rutger

Board Regular
Joined
Apr 5, 2005
Messages
74
Hey there,
i have a question.
i have a userform that contains all data from a company.
It gets the data from a heet called "companies".
The userform is opened by clicking a button on another userform("menu").
This far it works ok.
The problem is that i have more companies in that one sheet that i want to call from that one userform ( so when the button company2 on the menu is pressed it open's the data userform and displays the data from that company.
On the sheet "Companies" all the data for each company is in the same location except 50 rows lower.
I don't know how i can easily call those different rows.

I tried sopmething like:


Code:
Public Sub UserForm_Activate()
Dim T As String



Label18.Caption = "U bent ingelogd als: " & Login!Name.Value
Label1.Caption = TextBox1.Value

Site!TextBox1.Value = [Sheets]![Sites].Cells(40 + T, 1).Value
Site!TextBox2.Value = [Sheets]![Sites].Cells(40 + T, 2).Value
Site!TextBox3.Value = [Sheets]![Sites].Cells(40 + T, 3).Value
Site!TextBox4.Value = [Sheets]![Sites].Cells(40 + T, 4).Value

in this i want to define T in every button click event
i.e.

Code:
Private Sub CommandButton17_Click()
Dim T As String
T = "50"

If anyone can help me i would greatly appreciate it


Greetz,
Rutger
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Sorry, maybe it's just me, but I don't understand what you mean.

What data do you want on the userform
 
Upvote 0
hmmm, let me try it again

Basically, what i want is this:

I want to load data into the textboxes in a userform whenever that userform is opened.
It will be opened from different buttons on another userform.
If it is openend trough button A I want it to load data from companie A, if it is openend trough button B i want it to load data from companie B etc.
The data is all stored in a sheet.
If companie A is stored in cell A1 then company B is stored in cell A50 and so on.
I found out how i can get the data of compay A into my userform and i can also clear all textboxes when i hide the userform. Now i need to find way to make this line:
Code:
Site.TextBox1.Value = [Sheets]![Sites].Cells(40, 1).Value
flexible so that when button B is pressed the value 40 will change into 40 + 50 = 90.

I hope this makes it more clear

Greets,
Rutger
p.s. and thanks for helping
 
Upvote 0

Forum statistics

Threads
1,214,848
Messages
6,121,914
Members
449,054
Latest member
luca142

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