Hi

I'm getting a runtime error 1004 message on the following code when trying to execute the line in bold and I don't know why. I have checked to see if the macro is in module as opposed to a sheet and it is so that's not what is causing the problem. It works fine if I am in the sheet I am trying to execute the code on but fails if I don't have that sheet activated i.e. the first line of code also fails unless I am in that worksheet.

New to VBA but I'm guessing it's something to do with the way I have declared Thisworkbook.

Option Explicit

Dim DataFilepath As String
Dim DataFile As Workbook
Dim GiltRV As Workbook

Sub ImportData()

Set GiltRV = ThisWorkbook

GiltRV.Sheets("CALCS2 ALL").Range("E14", Range("E14").End(xlDown)).clearcontents
GiltRV.Sheets("T-1 Data").Range("B8", Range("B8").End(xlDown)).clearcontents
Any help appreciated.