Macro to change cell String

Papi

Well-known Member
Joined
May 22, 2007
Messages
1,592
The code is written to change the category in column R of the active row. There are three options and three macros written as below. They are CURRENT, PAID and REVIEW. It it possible to run the same under one macro and have it cycle thru each time the macro button is clicked? If it was CURRENT then it would change to PAID and if done again to REVIEW, and again to REVIEW etc?

Code:
Private Sub CommandButton20_Click()
' CHANGE TO PAID

    Select Case ActiveCell.Row
    Case 1 To 5
        MsgBox "PAID macro will not work on row " & ActiveCell.Row & ".  Please try again!",
Exit Sub
End Select
    Range("R" & ActiveCell.Row).Value = "PAID"
    Range("S" & ActiveCell.Row).Select

End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Try this:
Supplied by VOG earlier.

Sub BigMacro
Call Macro1
Call Macro2
Call Macro3
'etc
End Sub
 
Upvote 0
Thanks for taking the time to respond. That does not work as it scrolls all the way through without stopping and finishes with Macro3 each time. The concept is close but it needs to stop after running the first one with the user being able to run it one more time or more.
 
Upvote 0
See if this code does what you want...
Code:
Sub CommandButton20_Click()
  Dim FirstWord As String, Cat() As String
  If ActiveCell.Row < 6 Then
    MsgBox "PAID macro will not work on row " & ActiveCell.Row & ".  Please try again!"
  Else
    FirstWord = Split(Trim(Range("R" & ActiveCell.Row).Value & " REVIEW"))(0)
    Range("R" & ActiveCell.Row).Value = Split(Trim(Split("CURRENT PAID REVIEW CURRENT", FirstWord)(1)))(0)
    Range("S" & ActiveCell.Row).Select
  End If
End Sub
 
Upvote 0
Hello Rick,

Thanks so much. You always amaze so many people with your superior skills. That is smack on and works like a charm. Again thanks!
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

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