Select column and change values

dacast

New Member
Joined
Jan 11, 2023
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hi I have a code but is not working as expected.

the purpose is for the user be able to select a column, the VBA will look for a specific value and change to the custom one.
thank you for your help!



VBA Code:
Sub find_and_replace()

Dim find_value, replace_value As String
Dim MySelection As Range
    
    On Error Resume Next
    Set MySelection = Application.InputBox("Select the column", Type:=8)
    If MySelection Is Nothing Then Exit Sub 'user canceled
    On Error GoTo 0

    find_value = "missing"
    replace_value = InputBox("Please Enter the New Value")

    MySelection.Replace What:=find_value, _
    Replacement:=replace_value, _
    LookAt:=xlPart, _
    SearchOrder:=xlByRows, _
    MatchCase:=False, _
    SearchFormat:=False, _
    ReplaceFormat:=False

End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi,

Have you tested to select Column and hit Control + H ...
 
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,157
Members
452,615
Latest member
bogeys2birdies

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