Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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 ajoutée par Noushad Elachola , Senior Accountant , AAFAQ-Islamic finance
Date de publication: 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
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?