I am having a "Run-time Error '13' Type Mismatch" when attempting to assign a worksheet to a variable. It works for all of the other worksheets but is seems to only happen to this worksheet.
Here is my code:
Sub TS()
Dim RD, Dep, QC, MM, Pro As Workbook
With ThisWorkbook
Set RD = .Sheets("RawData")
Set Dep = .Sheets("Departments")
Set QC = .Sheets("QC")
Set MM = .Sheets("MM")
Set Pro = .Sheets("Production") 'I have a problem with this line
End With
End Sub
My worksheet labels are below:

The error is pertinent to your erroneous declaration:
Pro As Workbook
You should declare it as Worksheet, or just variant without specifying the type, like:
Dim RD, Dep, QC, MM, Pro
A better way would be to use the strong typed declaration:
Dim RD As Worksheet, Dep As Worksheet, QC As Worksheet, MM As Worksheet, Pro As Worksheet
Hope this may help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With