I have two variables Temp
and aw
that are both workbooks. I want to test if aw
is empty, and if so, assign it to be the activeworkbook. I tried
if len(aw) = 0 then
set aw = activeworkbook
but I kept getting an error.
Static aw As Workbook
Dim Temp As Workbook
Set Temp = ActiveWorkbook
If Temp = aw Then
GoTo Here
ElseIf Len(aw) = 0 Then
Set aw = ActiveWorkbook
Else
Application.ScreenUpdating = False
aw.Activate
ActiveSheet.Range("K5:K7").Clear
Set aw = Temp
aw.Activate
Application.ScreenUpdating = True
End If
Here:
aw.Activate
ActiveSheet.Range("K5").Select
Selection.Value = 15 * 60