|
-
Dec 9th, 2005, 07:23 PM
#1
Thread Starter
New Member
VBA excel grab macro
Hey guys,
Im having a little trouble writing a VBA excel macro that, when a button is pressed, copies data from one (open) excel data file to a different (open) master file that will aggregate the data. The data files will we opened separately and the button will be pressed each time.
The information in each data file needs to be copied from row 3, column A until end of data, and the pasted AT THE END OF ANY DATA in the master file starting at column.
For each of the data files' data; In column A I need the date created from the properties information. In column B I need the time created (to the minute) from the properties information. In column C I need the data in cell E2 of the data file to also be copied next to that files data.
There are around 50 data files I need to copy into the master file.
If anyone can do this I would really appreciate your help.
-
Dec 9th, 2005, 07:39 PM
#2
Hyperactive Member
Re: VBA excel grab macro
 Originally Posted by njohnston
...
The information in each data file needs to be copied from row 3, column A until end of data, and the pasted AT THE END OF ANY DATA in the master file starting at column.
For each of the data files' data; In column A I need the date created from the properties information. In column B I need the time created (to the minute) from the properties information. In column C I need the data in cell E2 of the data file to also be copied next to that files data.
...
Hello njohnston,
Welcome to the VBForums.com
for a start, where is the button placed? in the master excel file or in any other file?
do you know how to record a macro? ths can be very helpfull for you when you'll build your own macro.
do you have one workbook or 50 as you mentioned?
VB Code:
Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("D3").Select
ActiveSheet.Paste
this simple macro copies all the data from row 3 col A to col D starting from row 3 in the same Sheet...
Is that you need for a start?
Best Regards,
ERAN
Eran Fox
ASSEMBLER,C,C++,VB6,SQL...
-
Dec 9th, 2005, 08:10 PM
#3
Thread Starter
New Member
Re: VBA excel grab macro
Eran,
Thats a great start. I am only new to VBA, so I don't know much about programming. The button will be in the master file. So each time I need data I will open up the data file, press the macro button in the master file, and the data will be copied into the master file.
Thanks.
-
Dec 9th, 2005, 08:11 PM
#4
Thread Starter
New Member
Re: VBA excel grab macro
I have 50 data files (workbooks), but each one needs to be added separately.
-
Dec 9th, 2005, 09:54 PM
#5
Hyperactive Member
Re: VBA excel grab macro
Hello again,
do you understand that you will have to run on all the 50 workbooks every time and to open them through the code means you cant change their names!
this will take a long time.
i'm sure the code for that is simple and if it wasnt 4:00 in the morning i would have come with some example... ( i will try to write something tommorow)
but for now few tips to start with:
VB Code:
Range("A3").Select
Selection.End(xlDown).Select
this will bring you to the next (last) cell in the "A" column with values in it
but if you have cells with no values between cells with values then the focus will be on the first cell with values in it.
VB Code:
Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
this will select all the cells in the range between the A3 cell and last cell as i explained above.
VB Code:
Shell("C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE
C:\My Dcouments\secondWorkbook.xls", vbNormalFocus)
this will open a new work group, change the path and file name for your code.
Good night i need some sleep...
Best Regards,
ERAN
Eran Fox
ASSEMBLER,C,C++,VB6,SQL...
-
Dec 10th, 2005, 06:58 AM
#6
Re: VBA excel grab macro
Moved to Office Development.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|