Dear Miss Jan selvri pakai versi 2003 .. tetap ga bisa..Run-time error '1004' : application-defined or object-defined error tapi di versi 2007 bisa lhoh.. masalahnya dimana yaa dim rg as range, idxRow as long idxrow=cells(rows.count, 3).end(xlup).row
set rg = range(cells(2,17), cells(idxrow , 17)) rg.formula = "=Dateif(C2,Today(),""y"")&"" Tahun "" &Dateif(C2,Today(),""ym"") & "" Bulan "" & Dateif(C2,Today(),""md"" ) & "" Hari "" Terima kasih atas bantuannya -------- Original Message -------- Subject: Re: [belajar-excel] Dateif di vba Date: Thu, 27 Dec 2012 14:47:28 +0700 From: Jan Raisin <[email protected]> Reply-To: [email protected] To: [email protected] Dear Selvri, Coba script berikut: dim rg as range, idxRow as long ' cari nomor baris terakhir di kolom C idxrow=cells(rows.count, 3).end(xlup).row ' set area yang mau dipasang formulanya set rg = range(cells(nomor_baris_awal, nomor_kolom), cells(idxrow , nomor_kolom)) ' pasang formula ke range rg.formula="=DateDif(c2,today(),""y"") & "" Tahun "" & DateDif(c2 ,today(),""ym"") & "" Bulan "" & DateDif(c2,today(),""yd"") & "" Hari""" Perhatikan pemakaian tanda kutip dua di dalam script, untuk data dengan tipe string harus diawali 2x kutip dua dan diakhiri dengan 2x kutip dua. Formula yang digunakan adalah DateDif, ada huruf D di tengah Best Regards, -Ms. Jan Raisin-

