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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
.
.

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,196,073
Messages
6,013,267
Members
441,758
Latest member
Abren

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