Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How to save one table of data from one sheet to another using VBA?

How we can make a form in one sheet and save data in to a table in another sheet?

user-image
Question added by Noushad Elachola , Senior Accountant , AAFAQ-Islamic finance
Date Posted: 2013/07/26

In my example I used it as export for a time sheet.
The example is only a (very) small piece of the VBA script, gathering records, copying them to an export sheet, and saving it with a unique name, containing user-id and week-number.
In this1st example a new file is created: Sub Export() ' Select Data to Export Windows("SourceFile.xls").Activate Sheets("DataSource").Select ' Create copy of exported data as new file Sheets("DataSource").Copy ActiveWorkbook.SaveAs Filename:="DestinationFile.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _ , CreateBackup:=False ActiveWorkbook.Close End Sub Copying selected data from one to another, already existing file goes as follows: Sub Export2() ' Select Data to Export from one file to another file ' Please note that both files must be open Windows("SourceFile.xls").Activate Sheets("DataSource").Select Range("A1:Z9999").Select ActiveSheet.Copy ' Paste exported data into the destination file Windows("DestinationFile.xls").Activate Sheets("DataTarget").Select Range("A1").Select ActiveSheet.Paste End Sub I hope this helps.....

Rafiqul Islam
by Rafiqul Islam , Admin & Compliance sector , IT & Payroll, HR

Select the data, copy the data, Put cursor desire place then Past the data

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.