I'm trying to write a Clear-cells macro that (for example) does the following:
- Delete the contents cells A1:A15;
- Deletes the contents of cells C4:C8, D12:D15 and F9:G12;
- Sets the fontcolour in cell C1 to red and sets the fillcolor to yellow;
- Displays the text: Macro execution completed.
So far I've been able to write three macro's for eacht task, but I havn't been able to put it all in 1 macro. Can anyone help me?
Thanks a lo!
|Check out our Excel VBA Resources|
Try something like this;
Set ClrRg = Union(Range("A1:A15"), Range("C4:C8"), Range("D12:D15"), Range("F9:G12"))
Set Rg = Range("C1")
.Font.ColorIndex = 3
.Interior.ColorIndex = 6
MsgBox "Range has been cleared", vbInformation
Thanks a lot Ivan.