FINNROB
asked on
Excel VBA Macro
I am need to create a VBA in Excel, to copy information from the active workbook to a non-active workbook. The non-active file name will be "1mainworkbook". The active workbook could be one of over a 1,000 workbooks.
The issue is that as soon as I save and close the active workbook I lose the ability to paste the information into "1mainworkbook."
This appears to be the line that is causing the issues as I just guessed on how to create.
ActiveSheet.Paste Destination:=Workbook("1ma inworkbook .xlsm").Ra nge("a2:h2 ")
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
The issue is that as soon as I save and close the active workbook I lose the ability to paste the information into "1mainworkbook."
This appears to be the line that is causing the issues as I just guessed on how to create.
ActiveSheet.Paste Destination:=Workbook("1ma
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ASKER
Thank you for the effort. Unfortunately, there is nothing in the clipboard before I paste. Current Error MS VBA Compile error: sub or function not defined.
ActiveSheet.Paste Destination:=Workbook("1ma inworkbook .xlsm").Sh eets("Shee t1").Range ("a2:h2")
Does no appear to like the "Workbook"
ActiveSheet.Paste Destination:=Workbook("1ma
Does no appear to like the "Workbook"
In the below line you are trying to paste the already copied data
ActiveSheet.Paste Destination:=Workbook("1ma inworkbook .xlsm").Sh eets("Shee t1").Range ("a2:h2")
I was asking about the line which is copying the data.
ActiveSheet.Paste Destination:=Workbook("1ma
I was asking about the line which is copying the data.
ASKER
Sorry
Here it is
Sheets("INVOICE").Select
Range("J150:Q150").Select
Selection.Copy
Here it is
Sheets("INVOICE").Select
Range("J150:Q150").Select
Selection.Copy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your help. This worked.
You're welcome. Glad to help.
Destination:=Workbook("1ma
And it should be like this...
Destination:=Workbook("1ma