Changing data using Userform listbox

Deepk

Board Regular
Joined
Mar 21, 2018
Messages
105
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I want a macro which can give single name to all similar data in a column. Sample data provided below:

ABC.com
ABC.com
ABC.com
Xyz.llb
Xyz,tz
Gisp inc
Gisp tpo

After running the macro, the excel data in selection to be displayed like:

ABC
ABC
ABC
Xyz
Xyz
Gisp
Gisp

For this purpose, I have included a userform having a listbox to display the data in selection. Find the code below.

Private Sub UserForm_Initialize()
Dim cell As Range
Dim Rng As Range
Set Rng = Application.Selection
For Each cell In Rng
ListBox1.AddItem cell.Value
Next cell
End Sub

Additionally, the userform following commandButtons
commandbutton1 (for rename)
commandbutton2 (next)
commandbutton3 (previous)
commandbutton4 (exit)

Please see the steps below that have to be followed one after another during execution.

1. After running macro listbox of the userform should display all unique entries which started with alphabet A
2. clicking the ‘next’ button the listbox displays all entries which started with next alphabet B and so on.
3. ‘previous’ button work opposite to the ‘next’ button
4. The listbox allows multiselection of the displayed entries
5. after multiple selection and clicking ‘rename’ button, an inputbox will appear which contains the first entry in the listbox selection
6. The user can edit the entry in the inputbox
7. After user input, all the entries in listbox selection replaced with the user inputted data and same is also changed in the backend data (excel data in selection)
8. the ‘exit’ button causes unloading of the userform.

Please help me with code for this macro. Looking forward in anticipation.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
hi all,

I look forward to hearing from you on the above request. Thank you.
 
Upvote 0

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

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