Userform copy textbox value to different range depending on Combobox selction

icsiszer

New Member
Joined
Jul 10, 2018
Messages
3
Hello to all!

This is my first post here and I'd just started learning VBA.

I'm working on a project that in one point it needs a userform with the following function:
I will have a combobox with 3-4 values, and textboxes for each month (so 12 textboxes).

What I need now is that the values from the month to be added in different ranges depending on the selection from the combobox.

I hope somebody will help me out.

Thank you a lot!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
You get the selection form the Combobox using

variablename = userform.comboboxname.VALUE

and using either IF statements or a SELECT CASE statement, set the textboxes

Code:
IF variablename = "X" Then userform.textname.VALUE = "Value 1"

or...

Code:
SELECT CASE variablename
   CASE "X"
     userform.textname.VALUE = "Value 1"
   CASE "Y"
      userform.textname.VALUE = "Value 2"
   CASE ELSE
       userform.textname.VALUE = "Value 3"
End Select
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

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