I'm running an Excel Macro that is store in the active workbook. I want it to prompt to open a file, referenced as OldWorkbook and copy values from OldWorkbook then paste their values into the active workbook.
I'm having errors after the 'Copy range to clipboard note. It's like it doesn't recognize any value to "OldWorkbook" at this point?
Sub Version_Convert()
Dim OldWorkbook As Variant
OldWorkbook = Application.GetOpenFilename("Excel Files (*.xl*),*.xl*", , "Choose File", "Open", False)
If OldWorkbook = "False" Then
Else
Workbooks.Open (OldWorkbook)
End If
'Copy range to clipboard
Workbooks(OldWorkbook).Worksheets("PKG").Range("B12:CW28").Copy
'PasteSpecial to paste values, formulas, formats, etc.
ThisWorkbook.Worksheets("PKG").Range("B12:CW28").PasteSpecial Paste:=xlPasteValues
End Sub
Why is using the string giving me an error? How do I make OldWorkbook usable?