userform with many Modes..

Hjemmet

Board Regular
Joined
Jun 20, 2018
Messages
207
On a userform i have these Function's
Combobox1
Labels 1 to 7
Textbox 1 to 10
and Commanbutton 1 to 7

I need the Combobox to Look on Range from Cell ("A1:A127") i get it to work on these Codeline

Code:
Private Sub UserForm_Initialize()'add column of data from spreadsheet to your userform ComboBox
ComboBox1.List = Sheets("Ark3").Range("A1:A127").Value


end Sub
But i can't figure out to get Value from Cell when Combobox1 is Set to "1" then Label1 set value from "B1" and Label2 set value From "D1"
and so on with Combobox1 from 1 to 127 Label1 and Label2 take value from B1 to B127 and D1 to D127

hope that was enough info
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Not sure why you need Command Buttons or Textboxes

This script will run when you select a value from ComboBox1

Assuming you have 7 labels named Label1 Label2 etc.

Code:
Private Sub ComboBox1_Change()
'Modified  7/29/2019  10:39:35 PM  EDT
Dim i As Long
Dim x As Long
x = 2
For i = 1 To 7
    Me.Controls("Label" & i).Caption = Cells(ComboBox1.ListIndex + 1, x).Value
    x = x + 2
Next
End Sub
 
Last edited:
Upvote 0
The textbox’s will be used later in my programming combined
With the Command buttons

it try your code later after I got free from work
 
Upvote 0
Soory but i couldne get it to Work so i know put a link to my file here

Code:
https://www.dropbox.com/s/i7witfxukosklmj/total%20changes%20with%20description%201.xlsm?dl=0
 
Upvote 0
I never open files posted on this form

So my script does this:

You said you had a script in your Userform that loads all values from A1 To A127 of active sheet into ComboBox1

Now when you select a value in the ComboBox1 you want for example.

If you choose 3 from listbox1 and the 3 is on line row(3) column A

Then Label1 caption will have the value from row(3) column (2 and Label2 caption will be from Row(3) column 4 and so on for all 7 labels.


Explain exactly what happened and what you want if not what I describe.

Are all your labels named Label1 then Label2 and etc?

Saying:
Soory but i couldne get it to Work

Does not tell me much. Did you get a error code?
Or what exactly did not work.
 
Upvote 0
7C5Wm1H
I got this picture what happen

1. start userform "
VH7K4qf[COLOR=

2. after Chosen "1" on my Combobox "
Nxp9L63[COLOR=

3. then userform looks like this "
3YNY9y1[COLOR=

4. then this Failor
HdVh929[COLOR=
 
Last edited:
Upvote 0
I try Again....

Combobox1 looks on Column A1 to A127 to get Value to Label's in sheet's ("ARK3") and Sheets IS NOT Worksheets or main Sheets' Macro will Call the Userform

If Combobox1 Is set "1 - 127" then Label1 , 3, 5, 7 Read cell "B1 - B127" and Label2 , 4 , 6 , 8 Read cell "C1 - C127"

and Label 9 read from cell "D1 - D127"
and Label 10 read from Cell "E1 - E127"

and so on until 127

Hope that was more then enough Info as first time
 
Upvote 0
So tell me what do you have in this ComboBox on your Userform?

Do you have:
1
2
3
4
5
6
and on and on

so if you select 1 you search row(1) is that what your saying


And I assume your labels are on the Userform.

And you said:
If Combobox1 Is set "1

You do not normally set a ComboBox.

You normally select a value in the Combobox

Is that what you mean you select the number 1

Or do you mean you select the first item in the ComboBox

And I sure do not know what this means:
and Sheets IS NOT Worksheets or main Sheets' Macro will Call the Userform

 
Upvote 0
You said in your original post:
Labels 1 to 7

But in post 7 you said:

and Label 9 read from cell "D1 - D127"
and Label 10 read from Cell "E1 - E127"

Are you now saying you have 127 labels on your UserForm?

What is your end goal?

Why would you want 127 Labels on a UserForm?






So now it sounds like you have 127 Labels

<strike>
</strike>
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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