J
Jay
Why is the following code not allowing me to switch between workbooks?
I get a Run-time error '13':
Type mismatch
on line
Workbooks(SourceWkbk).Activate
Sub Copy_WOs ()
Dim DestWkbk As Workbook
If Range("I2") = "" Then
MsgBox "Enter Person Reporting in Cell I2"
Exit Sub
ElseIf Range("I2") = "Jay" Then
Set DestWkbk = Workbooks.Open("H:\FAC\JayProjTimeTracking.xls",
UpdateLinks:=False, ReadOnly:=True)
ElseIf Range("I2") = "Dave" Then
Set DestWkbk = Workbooks.Open("H:\FAC\Dave
Sipes\DavProjTimeTracking.xls", UpdateLinks:=False, ReadOnly:=True)
Else
MsgBox "Person Reporting name mispelled (or is in all caps)"
Exit Sub
End If
Workbooks("SourceWkbk.xls").Activate
Range("F6:F12").Copy
Workbooks(DestWkbk).Activate
Range("D:7").Select
Activesheet.Paste
End Sub
I get a Run-time error '13':
Type mismatch
on line
Workbooks(SourceWkbk).Activate
Sub Copy_WOs ()
Dim DestWkbk As Workbook
If Range("I2") = "" Then
MsgBox "Enter Person Reporting in Cell I2"
Exit Sub
ElseIf Range("I2") = "Jay" Then
Set DestWkbk = Workbooks.Open("H:\FAC\JayProjTimeTracking.xls",
UpdateLinks:=False, ReadOnly:=True)
ElseIf Range("I2") = "Dave" Then
Set DestWkbk = Workbooks.Open("H:\FAC\Dave
Sipes\DavProjTimeTracking.xls", UpdateLinks:=False, ReadOnly:=True)
Else
MsgBox "Person Reporting name mispelled (or is in all caps)"
Exit Sub
End If
Workbooks("SourceWkbk.xls").Activate
Range("F6:F12").Copy
Workbooks(DestWkbk).Activate
Range("D:7").Select
Activesheet.Paste
End Sub