ku kasih 4 cara ya..
Cara 1
Sub Macro1()
Application.Calculation = xlCalculationManual
Range("C2").Select
ActiveCell.FormulaR1C1 = "=RC[-2]*RC[-1]"
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C18")
Range("C2:C18").Select
Range("D2").Select
ActiveCell.FormulaR1C1 = "=RC[-2]*RC[-1]"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D18")
Range("D2:D18").Select
Application.Calculation = xlCalculationAutomatic
Range("A2").Select
End Sub
Cara 2
Sub test1()
Dim LastRow As Long
Application.Calculation = xlCalculationManual
LastRow = Cells(Rows.Count, "b").End(xlUp).Row
With Range("c2")
.FormulaR1C1 = "=RC[-2]*RC[-1]"
.Select
.AutoFill Destination:=Range("C2:C18")
End With
With Range("D2")
.FormulaR1C1 = "=RC[-2]*RC[-1]"
.Select
.AutoFill Destination:=Range("D2:D18")
End With
Application.Calculation = xlCalculationAutomatic
End Sub
Cara 3
Sub test2()
[b1].Select
i = i
Application.Calculation = xlCalculationManual
Do
i = i + 1
ActiveCell.Offset(i, 1).FormulaR1C1 = "=RC[-2]*RC[-1]"
ActiveCell.Offset(i, 2).FormulaR1C1 = "=RC[-2]*RC[-1]"
Loop Until IsEmpty(ActiveCell.Offset(i))
ActiveCell.Offset(i, 1).Resize(, 2).Delete
Application.Calculation = xlCalculationAutomatic
End Sub
Cara 4 Jika Datanya selalu sama, coba gunakan record macro
Pada tanggal 08/03/09, denny co <[email protected]> menulis:
> Pls di bantu,
>
> Konsep makro untuk perulangan-nya gimana ya
>
> Formula
> total1 = harga * jumlah
> total2 = total1* 2
>
> data di bawah jumlah fluktuatif, bisa sampai ribuan...
> gimana konsep perulangan nya ya teman2, so pada saat klik perintah(jalankan
> makro), otomatis di total1 & total2 langsung terisi. data nya bisa ribuan
>
> terimakasih banyak
>
>
>
>
>
>
>
>
>
>
> harga
> jumlah
>
> total1
> total2
>
>
> Rp100.000
> 1
>
>
>
>
> Rp100.000
> 2
>
>
>
>
> Rp100.000
> 3
>
>
>
>
> Rp100.000
> 4
>
>
>
>
> Rp100.000
> 5
>
>
>
>
> Rp100.000
> 6
>
>
>
>
> Rp100.000
> 7
>
>
>
>
> Rp100.000
> 8
>
>
>
>
> Rp100.000
> 9
>
>
>
>
> Dst
>
>
>
>
>
> ..
>
>
>
>
>
> ..
>
>
>
>
>
>
>
>
>