I have created an EXCEL 2010 workbook (e.g., workbook1) which has a macro that (1) opens up another workbook (e.g., workbook2), (2) extract data from workbook2 and puts information into an array of the workbook1 VBA code, (3) closes workbook2, and then continues running the macros in workbook1.
Macro works if (1) you run macro from VBA or (2) you run macro from developer/macros selection.
Macro opens workbook2 and then macro stops if I run macro through shortcut (SHIFT_CNTL_U)?
If shortcut just calls macro, any thoughts on why it would stop?
Simple Example of VBA code below (macro stops succesfully executing Workbooks.Open command:
Sub TESTER()
Dim DataMatrix(5) as integer, i as integer
Dim Analysis(5) as integer
Dim ws As Worksheet, wb As Workbook
'
Set wb = Workbooks.Open("c:\workbook2.xlsx")
Sheets("Data").select
Range("A5").select
For i = 0 to 4
DataMatrix(i) = activecell.offset(0,i).value
Next i
wb.close
'
For i = 0 to 4
Analysis(i) = DataMatrix(i) * 2
Next i
'
end sub
Workbook_Open
? – HackSlash