Userform Combobox list replace selected value with value from inputbox

matija385

Board Regular
Joined
Sep 17, 2014
Messages
77
Hi,

I have userform4 and combobox1 that is filled from range that is in Table28. What i would like to do is possibility to change values inside that Table28.

For example:

Table28 values are:

XXX
ZZZ
YYY
WWW

So, when i select XXX value in combobox, i get inputbox with question "Enter text to replace XXX", i enter desired text (for ie AAA) and when i click OK, value XXX in Table28 is replaced with my desired text (entered in inputbox, in this example AAA).

I quite new to vba, so i would very much appreciate some help.

Thank you,

Matija
 
This should work...

Code:
[COLOR=#0000ff]Sub[/COLOR] Test()


[COLOR=#0000ff]Dim[/COLOR] myNewValRng [COLOR=#0000ff]As Range[/COLOR]
[COLOR=#0000ff]Set[/COLOR] myNewValRng = Sheets("Administracija").Columns(1).Find(What:="New York", _
                    LookIn:=xlValues, _
                    LookAt:=xlWhole, _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlNext, _
                    MatchCase:=[COLOR=#0000ff]False[/COLOR], _
                    SearchFormat:=[COLOR=#0000ff]False[/COLOR])
                    
[COLOR=#0000ff]If[/COLOR] myNewValRng [COLOR=#0000ff]Is Nothing Then[/COLOR]
    MsgBox "Not Found"
[COLOR=#0000ff]Else[/COLOR]
    MsgBox "Found"
[COLOR=#0000ff]End If[/COLOR]
[COLOR=#0000ff]
[/COLOR]
[COLOR=#0000ff]End Sub[/COLOR]
 
Upvote 0

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.

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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