With code like this you need a worksheet reference for Cells as well as Range.
Here's a couple of ways you can do that.![]()
ws.Range(Cells(21, x), Cells(23, 15)).ClearContents
You'll need to add a worksheet reference for Cells wherever you have code like this.![]()
ws.Range(ws.Cells(21, x), ws.Cells(23, 15)).ClearContents ' or With ws .Range(.Cells(21, x), .Cells(23, 15)).ClearContents End With
Bookmarks