Fi69
asked on
Excel undo my sub
Hello experts
I have the following procedure that applies styling to the selected cells, but I want to be able to press the Undo button.
How would I go about doing an undo procedure? I understand that it would need to take note of the range of cells and store the font name/size/bold/color for each cell and then reapply it, but I'm really not sure how to go about that. Maybe I'm off track with my thoughts there. Not sure. Help!!
I have the following procedure that applies styling to the selected cells, but I want to be able to press the Undo button.
How would I go about doing an undo procedure? I understand that it would need to take note of the range of cells and store the font name/size/bold/color for each cell and then reapply it, but I'm really not sure how to go about that. Maybe I'm off track with my thoughts there. Not sure. Help!!
Public Sub StyleHeading()
ApplyHeading Selection
End Sub
Public Function ApplyHeading(ByVal r As Range)
Dim c
For Each c In r
With c.font
.Name = "Arial"
.Size = 12
.Bold = True
.Color = RGB(0, 100, 177)
End With
Next
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.