Sub CreateWB() Dim wbExcel As Object Set wbExcel = CreateObject("Excel.Application") Dim wbNew As Workbook Dim wbOld As Workbook wbExcel.Visible = True Set wbNew = wbExcel.Workbooks.Open("filename1") Set wbOld = wbExcel.Workbooks.Open("filename2") End Sub
Sub Comparison() wbOld.ActiveSheet.Range("F1").Select End Sub
Unfortunately, I cannot get it to work.
I know that the wbOld and wbNew is out of scope and therefore not working, but I do not know how to set them up as global variable.
Any help would be greatly appreciated. Thanks.