Input Box prompt

cornepiek

New Member
Joined
Jun 22, 2010
Messages
48
Hi all

i have an input box prompt to enter a value to delete.

however, the datasheet varies and can be up to a couple of thousand rows long.
so it is difficult to type the exact value to delete.

in column A i will have a customer name repeating for each change in column B.


so i will have
A2 - Mobifin B2 - National Calls
A3 - Mobifin B3 - Local Calls
A4 - Mobifin B4 - Cell Calls
A5 - Maxtel B5 - National Calls
A6 - Maxtel B6 - Local Calls
A7 - Maxtel B7 - Cell Calls


is it possible to have the input box prompt have a dropdown with all the various names in column A.
the idea is to have a dropdown containing

Mobifin
Maxtel.

then i can choose what i need to have deleted without making spelling mistakes
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
thanks. i also cam across this one, but im bit of a noob with VBA.


here is my vba macro.

the macro will delete all rows, where the value of column a does NOT contain string from input box

Sub delete_It()

Sheets("Sheet1").Select

Dim MyRange1 As Range
Dim MyRange As Range
Dim strToDelete As String

strToDelete = InputBox("Value to Trigger Keep", "Delete Rows")

lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A2:A" & lastrow)
For Each c In MyRange
If InStr(1, UCase(c.Value), strToDelete, 0) = False Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
If Not MyRange1 Is Nothing Then
MyRange1.Delete
End If

End Sub


i just need to add the above script to make the input box display the list
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,135
Members
452,890
Latest member
Nikhil Ramesh

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