ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل Noushad Elachola , Senior Accountant , AAFAQ-Islamic finance
تاريخ النشر: 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
من قبل Rafiqul Islam , Admin & Compliance sector , IT & Payroll, HR

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

المزيد من الأسئلة المماثلة