I have seen a lot of information on getting several command buttons to do similar things, but everything I've seen is about user forms.
I want to have a group of command buttons move data from a cell to another cell. I just don't want to copy and paste the same code into each command button.
Here is part of what I want to do for each command button:
Range(CommandButton1.TopLeftCell.Address).Select
Selection.Copy
If Application.WorksheetFunction.IsText(Range("R5")) And Range(CommandButton1.TopLeftCell.Address).Value <> Range("R5") Then
Range("R6").Select
ActiveSheet.Paste
Range(CommandButton1.TopLeftCell.Address).Select
Else
Range("R5").Select
ActiveSheet.Paste
Range(CommandButton1.TopLeftCell.Address).Select
End If
Application.CutCopyMode = False
I've tried to use class modules but can't seem to get it to function at all. I want to be able to throw that code into a class or something to run on all command buttons in a certain group. I would then want a different group of command buttons on the same sheet to execute different code.
What route should I take?