Tampilkan postingan dengan label change folder. Tampilkan semua postingan
Tampilkan postingan dengan label change folder. Tampilkan semua postingan

Rabu, 26 Desember 2012

Simpan file sekaligus mengganti dan menghapus file lama

Bagaimana menyimpan file baru dengan macro dan mereplace file lama yang namanya sama.

contoh file baru disimpan dengan nama book2.xlsx, padahal mungkin file lama sudah ada difolder tersebut dengan nama yang sama.

Dim Wk As Workbook

If Dir("C:\book2.xlsx") <> "" Then
Kill "C:\book2.xlsx"
Else 'http://mymacrosformula.blogspot.com/

Senin, 08 Oktober 2012

Mensiasati File yang terlalu besar Bag.2

Salah satu cara mengecilkan file adalah dengan membuat file kedua salinan yang merupakan hanya sebagai laporan.

misal ada file 1 induk perhitungan (didalam file banyak sekali rumus vlookupnya dan sumifnya sehingga file berkembang menjadi 30 mega)
lalu tehnik yang saya lakukan adalah http://mymacrosformula.blogspot.com/


Penjelasan dan contoh soal:
1. difile 1 induk perhitungan dibikin alamat cell tertentu misal (cell m40) dengan rumus mis : http://mymacrosformula.blogspot.com/

="cek balance "&MID(A3;6;20)&" per "&TEXT(NOW();"dd-mm-yyyy pukul HH'Mm")&".xls"

hasil dari rumus itu akan menjadi "cek Balance September 2012 per 08-10-2012 pukul 11'16.xls"
http://mymacrosformula.blogspot.com/
alamat ini nanti akan menjadi nama file salinan yang ukurannya lebih kecil dengan menghilangkan rumus referensi dari file induk menjadi value.


2. Bikin Macro untuk mengcopy beberapa sheet yang diperlukan dari file induk ke file baru dengan nama di cell yang sudah ditentukan diatas.dengan macro :

Sheets(Array("Cek balance", "Cek face perdist p", _

"Cek face perdist r", "Cek face perdist n", "PPAIDperdist", "RPAID perdist", _
"NPAID perdist")).Select

Sheets("Cek Balance").Activate
Sheets(Array("Cek Balance", "Cek face perdist p", _

"Cek face perdist r", "Cek face perdist n", "PPAIDperdist", "RPAID perdist", _
"NPAID perdist")).Copy

'menyimpan dengan nama dari alamat cell
ChDir "D:\1 interf pst"

ActiveWorkbook.SaveAs Filename:= _
(Range("m40"))
Range("C8").Select

3. Menyimpan file dalam bentuk format excel 2003 lalu menutup atau memisahkan semua link dari file 1 induk perhitungan. sehingga menjadi berdiri sendiri. dan otomatis semua rumus dan fungsi referensi seperti vlookup, hlookup, maupun sum if menjadi value.

ActiveWorkbook.SaveAs Filename:= _

(Range("m40")) _
, FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.BreakLink Name:= _
"D:\1 interf pst\bulan lalu\1 file induk perhitungan.xls", _
Type:=xlExcelLinks

4. Sampai proses ketiga ini jalankan dulu macronya untuk mengetahui link mana saja yang tidak terputus. Catat di cell mana saja link tidak terputus. lalu dibuat copy value untuk semua cell tersebut. (catatan : macro edit link diatas tidak berhasil memutuskan semua link)
kemudian menyimpan file baru salinan yang hampir tanpa rumus itu.


berikut adalah copy paste value untuk cel cel yang linknya tidak terputus :
Sheets("Cek balance").Select

Range("I6").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Cek balance").Select
Range("M40").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

Range("k43:l43").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Cek face perdist p").Select
Range("A8").Select
Sheets("Cek face perdist p").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Save

Selasa, 05 Juli 2011

COPY FILE MENGGUNAKAN MACRO EXCEL VBA








BERIKUT ADALAH RUMUS FORMULA UNTUK MENYALIN FILE



MENGGUNAKAN EXCEL VBA.


























No rumus keterangan
1 How to get the active station and folder name: MsgBox "Active station and folder name: " & CurDir How to change the active station: ChDrive "F" ' changes to the F-station How to change the active folder: ChDir "F:\My Documents\Private" How to determine if a file exists in a folder: If Dir("F:\My Documents\My Workbook.xls") <> "" Then ' the file exists, returns "" (empty string) if the file doesn't exist. How to delete a file : Kill "F:\My Documents\My Workbook.xls" If you don't specify the station, Excel uses the active station. If you don't specify the folder, Excel uses the active folder. How to create a new folder: MkDir "NewPrivateFolder" ' creates a new folder in the active folder MkDir "F:\My Documents\NewPrivateFolder" ' creates a new folder in the existing folder F:\My Documents How to delete a folder (folder must be empty): RmDir "NewPrivateFolder" ' deletes the subfolder NewPrivateFolder in the active folder RmDir "F:\My Documents\NewPrivateFolder" ' deletes the subfolder NewPrivateFolder in the folder F:\My Documents How to copy a file (the file must be closed): FileCopy "OrgWorkBook.xls", "CopyWorkBook.xls" ' copies OrgWorkBook.xls to CopyWorkBook.xls in the active folder FileCopy "OrgWorkBook.xls", "F:\My Documents\CopyWorkBook.xls" ' copies OrgWorkBook.xls from the active folder to F:\My Documents\CopyWorkBook.xls How to move a file (the file must be closed): OldFilePath = "C:\OldFolder\Filename.xls" ' original file location NewFilePath = "C:\NewFolder\Filename.xls" ' new file location Name OldFilePath As NewFilePath ' move the file
2

Sum


ber

Semua petunjuk diatas diambil dari situs di samping : http://www.exceltip.com/st/Basic_file_and_folder_examples_using_VBA_in_Microsoft_Excel/443.html
c c c








Kegunaannya adalah kita dapat mengcopy file apapun atau backup, hapus hanya dengan membuka atau menjalankan macro dari excel atau membuat tombol di file excel untuk menjalankan proses copy file

Senin, 23 Mei 2011

Mensiasati file excel yang terlalu besar

Saya lebih suka Excel 2003 walau jumlah barisnya 65.000 baris. Dalam pemakaian sehari hari saya pernah menggunakan file sampai file Excel tersebut berkembang ukurannya menjadi 10 MB per satu file excelnya.Wah beratnya bukan main kalau saya buka dirumah karena prosessing komputer di rumah kecil Tapi dikantor sudah pakai Intel Core Duo jadi tidak begitu masalah. Ukuran file tersebut membesar karena banyaknya link, rumus rumus reference seperti vlookup, hlookup, sumif, dst.... Dengan makin banyaknya data dan perhitungan yang akan dimasukkan lagi file tersebut mungkin akan menjadi 20 MB.
http://mymacrosformula.blogspot.com/
Sehingga saya mencari jalan keluarnya yaitu dengan Copy paste value, saya pecah file tersebut menjadi 3 s/d 4 file. Dan perpindahan perhitungan antar file menjadi value dengan macro dan copy dan paste di file satunya dengan macro atau AHK.
http://mymacrosformula.blogspot.com/
dan cara lainnya adalah dengan membagi file menjadi file khusus untuk perhitungan dan file khusus untuk laporan atau tampilan saja tanpa rumus. memisahkan filenya bisa dengan macro seperti yang saya bahas pada posting selnajutnya di :

http://mymacrosformula.blogspot.com/2012/10/mensiasati-file-yang-terlalu-besar-bag2.html

http://mymacrosformula.blogspot.com/

Page View