replace button

MrCo0ol

New Member
Joined
Sep 23, 2014
Messages
3
I want to create a button that when some one click the button, it will replace "A" to "AP"in a specific column

Actully the case is i want to make a approve button for my manager to approve leave. We mark the leave record "A" if the manager agree he click the button it wil turn AP, for slick leave, mark S , when click the button it turn SP.
Since one button only refer to one coulnm(one person) the other column remain unchange. Pls help, is urgent
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
.
.

Add a Command Button (ActiveX Control) to your worksheet with the following code (which should be placed in the code module corresponding to that specific worksheet).

Then select the cells containing your "A" or "S" values and click the command button. "A" will be replaced with "AP" and "S" will be replaced with "SP".

Code:
Private Sub CommandButton1_Click()

    If TypeName(Selection) = "Range" Then
        Dim Cell As Range
        For Each Cell In Selection
            With Cell
                Select Case .Value
                    Case Is = "A": .Value = "AP"
                    Case Is = "S": .Value = "SP"
                End Select
            End With
        Next Cell
    End If

End Sub
 
Upvote 0
I want to create a button that when some one click the button, it will replace "A" to "AP"in a specific column

Actully the case is i want to make a approve button for my manager to approve leave. We mark the leave record "A" if the manager agree he click the button it wil turn AP, for slick leave, mark S , when click the button it turn SP.
Since one button only refer to one coulnm(one person) the other column remain unchange. Pls help, is urgent

Someone help me please=[
 
Upvote 0
It works but can you make it to find "A" or "S" in a specific column, if it find A replace to ap if it find s replace to sp.
Thank you for yor help
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,952
Members
448,535
Latest member
alrossman

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