finaljustice
Board Regular
- Joined
- Oct 6, 2010
- Messages
- 175
Hello, I have to put several excel files informations dispersed in many files into one single excel file.
The problem im facing is that I have one open workbook that is the one running the macro, and i have to tell it to OPEN a specific workbook and retrieve the information saving it in variables and then closing the newly open workbook.
ALL of this i'm being able to do, but when I close the workbook to go back to the one running the macro and i'm having issues...
Here is the part of the code, so you can understand what I mean:
I guess im not writting the code properly to tell the macro to GO BACK to the MAIN workbook that is running the macro to paste the desired information. Could someone please help me out, I'm pretty stuck on this...
Thanks for your attention
Final <!-- / message -->
The problem im facing is that I have one open workbook that is the one running the macro, and i have to tell it to OPEN a specific workbook and retrieve the information saving it in variables and then closing the newly open workbook.
ALL of this i'm being able to do, but when I close the workbook to go back to the one running the macro and i'm having issues...
Here is the part of the code, so you can understand what I mean:
Code:
Set wbd = ActiveWorkbook 'this is the workbook running the macro
Set wsd = ActiveSheet 'this is the activesheet on the running macro
Do While ActiveCell <> Empty
FiletoOpen = "C:\Users\Luis\Desktop\Carols\Pedidos\" & ActiveCell.Value
Application.Workbooks.Open (FiletoOpen) 'Abrir workbook cliente
Set wbt = ActiveWorkbook 'this is the TEMPORARY workbook which I extract information from.
Application.ScreenUpdating = False
For i = 1 To wbt.Worksheets.Count
Sheets(i).Unprotect Password:="AABBAAAAABBT"
Sheets(i).Select
Cells.Select
Selection.UnMerge
Next
'there are several manipulations here to extract the desired info which I believe aren't relevant to my issu.
ActiveWindow.Close 'Close TEMPORARY workbook after it's been used.
'NOW HERE IS MY ISSUE
wbd.Sheets(1).Range("A1048576").Select 'ERROR OCCURS here, basically i'm trying to go back to the workbook that is running the macro to PASTE the information I too from the other workbook.
I guess im not writting the code properly to tell the macro to GO BACK to the MAIN workbook that is running the macro to paste the desired information. Could someone please help me out, I'm pretty stuck on this...
Thanks for your attention
Final <!-- / message -->