VBA Macro to export data to a new workbook

Closed
lmcpinho Posts 1 Registration date Wednesday April 16, 2014 Status Member Last seen April 21, 2014 - Apr 21, 2014 at 01:08 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Apr 24, 2014 at 11:30 AM
Hello all,

Trying to create a macro in VBA but getting some problems starting with it. If you can help it would be great!

Going to summarize what I need, if I made some mistake with the vba code names be patient, I'm not an expert in VBA.

This macro should have two tasks:

Task one:

I have a sheet (FILLER) in a workbook that is going to be used by several users.
This sheet has a simple table with data
This sheet is saved in a online folder (cloud), as well as all the rest of the files mentioned here.
I need to create a button that will allow the user to do the following:
- Open a new sheet
- copy and paste the data from the original table to a new one
- Save the file in a specific path
Cell A1 = user name
Cell A2 = Name of brand
Cell A3 = Name of Store
When selecting the path, it should follow this rule:
If A1=x, select and open folder (d:\folder\x)
if A2=y, select and open folder (d:\folder\x\y
Save file as d:\folder\x\y\z.xls) where z=A3

This is the end of task one for the macro.

Task two:
- Open file in d:\folder\data_base.xls)
- Check last row available in this sheet
- Copy and paste data from original file to this data_base sheet in this form:
A1
A2 to An;Bn;Cn , where n is the available row.
A3
- Copy and paste data from the original file to this data_base sheet in this form:
A4:Jn to Dn:Mn+m, where m= to rows with data in original sheet.

- Save and close data_base sheet
- Do not save data in FILLER sheet

Summing, at the end, after filling the data, the user will have, by clicking the macro, its table saved in a file at a specific path and the data saved in a general data_base sheet.

Hope you can help me.
Thanks a lot!
Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Apr 24, 2014 at 11:30 AM
Hi Imcpinho,

Good job on rephrasing your question.

There is one thing I want to check with you.
Task one:
You say you want to "open a new sheet".
Any name in mind for this new sheet (or did you mean new workbook as that would make more sense to me, otherwise you would have two of the same sheets in one workbook)?

Best regards,
Trowa
0