I can't seem to get my two open workbooks to set as variables. I have created a sub that opens the second one, so both now should be open.
But when I step through the code I get:
"rn-time error'438' object doesn't support this property or method.
I have tried both .Select
and Activate
. Both come back with errors.
have included the sub that opens the second workbook, for reference.
Sub copytoMaster()
Dim wkbk As Workbook
Dim NewFile As Variant
NewFile = "C:\Users\msheppar\Desktop\new holiday project\Master Holiday Tracker.xlsm"
If NewFile <> False Then
Set wkbk = Workbooks.Open(NewFile)
End If
End Sub
Sub CopyAndPaste()
Dim wbpast As Workbook
Dim wbcop As Workbook
Dim xlastrowcopy As Long
Dim xlastrowpast As Long
Dim xlastcolumnn As Long
Dim i As Integer
Dim j As Integer
Dim r As Integer
Dim rname As String
Set wbcop = Workbooks("Holiday form (9).xlsm")
Set wbpast = Workbooks("Master Holiday Tracker.xlsm")
'For i = 1 To xlastrowcopy
wbcop = ActiveSheet
Sheets("sheet4").Select