Hi,
This is a frustrating one as I can't understand why my code isn't working. I've tried several different variants of below, to no avail.
Basically, I'm trying to clear the contents of cell C23, if there are less than 4 values in a range. Cell Z500 is using a count formula to count the values in the range. But no matter what the contents are cleared from cell C23 when the file is opened. I've tried using an Else clause, but I'm getting an error regarding no 'Block If'
Thanks in advance
Mj
This is a frustrating one as I can't understand why my code isn't working. I've tried several different variants of below, to no avail.
Basically, I'm trying to clear the contents of cell C23, if there are less than 4 values in a range. Cell Z500 is using a count formula to count the values in the range. But no matter what the contents are cleared from cell C23 when the file is opened. I've tried using an Else clause, but I'm getting an error regarding no 'Block If'
Thanks in advance
Mj
VBA Code:
Private Sub Workbook_Open()
Dim myrange1 As Range
Set myrange1 = Sheets("Contract Award").Range("Z500")
If myrange1 < 4 Then Sheets("Contract Award").Select
Range("$C$23").ClearContents
Range("A1").Select
End Sub