Hi Experts -
I want to clear contents specifically from C15 to E column (Data is dynamic, the data always starts from Cell C15 and end data may change based on business volume.
So tried below VBA code, but getting error message as Compile error, Argument not optional.
Private Sub CommandButton1_Click()
Dim Sh As Worksheet, Myrange As Range
Set Sh = ActiveSheet
With Sh
Set Myrange = Union.Range("C15:E")
Myrange.ClearContents
End With
End Sub
Please help me if anything is wrong in the code, the error is getting at code line Set myrange = Union(
Thank you
Maddy
I want to clear contents specifically from C15 to E column (Data is dynamic, the data always starts from Cell C15 and end data may change based on business volume.
So tried below VBA code, but getting error message as Compile error, Argument not optional.
Private Sub CommandButton1_Click()
Dim Sh As Worksheet, Myrange As Range
Set Sh = ActiveSheet
With Sh
Set Myrange = Union.Range("C15:E")
Myrange.ClearContents
End With
End Sub
Please help me if anything is wrong in the code, the error is getting at code line Set myrange = Union(
Thank you
Maddy
Last edited: