MrHuge
Board Regular
- Joined
- Jun 23, 2005
- Messages
- 219
Hi,
i am trying to create a highlighted row before it is deleted, but if the user cancels from the message box, the formatting needs to stay as it was.
Currently i am using this code
This works to highlight the row with patterns, but when i answer No, the patterns dissapear, but the original fill color also sets to none.
Is there a way to fix this, or does anyone have a better solution to what im trying to do?
Thanks in advance.
i am trying to create a highlighted row before it is deleted, but if the user cancels from the message box, the formatting needs to stay as it was.
Currently i am using this code
Code:
Sub Macro1()
With Range(Cells(ActiveCell.Row, 2), Cells(ActiveCell.Row, 16))
.Font.Strikethrough = True
.Interior.Pattern = xlLightHorizontal
.Interior.PatternColor = 255
End With
answer = MsgBox("Do you want to delete row " & ActiveCell.Row() & " ?", vbYesNo)
If answer = vbNo Then
With Range(Cells(ActiveCell.Row, 2), Cells(ActiveCell.Row, 16))
.Font.Strikethrough = False
.Interior.Pattern = xlSolid
.Interior.PatternColor = xlNone
End With
End If
End Sub
Is there a way to fix this, or does anyone have a better solution to what im trying to do?
Thanks in advance.