Option Explicit
Private Sub CmdTAMBAH_Click()
Dim iRow As Long
Dim intTotal As Double
Dim ws As Worksheet
Set ws = Worksheets("dataentri")
Application.ScreenUpdating = False ' biar screen tetep diem selama proses
ndak kayak TV kurang sinyal
Application.DisplayAlerts = False ' biar excel ndak munculin pesen
peringatan
Application.Calculation = xlManual ' biar excel ndak ngitung mulu saat
proses
'''find first empty row in database
''iRow = ws.Cells(Rows.Count, 1) _
'' .End(xlUp).Offset(1, 0).Row
'revised code to avoid problems with Excel tables in newer versions
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'cek input data
If Trim(Me.txtMRIS.Value) = "" Then
Me.txtMRIS.SetFocus
MsgBox " masukan no mriss !!"
Exit Sub
End If
Dim lOpt As Long, lCol As Long
For lOpt = 1 To 9
If Controls("OB" & lOpt).Value Then
lCol = 3 + lOpt
Exit For
End If
Next lOpt
'posisi data baru (baris excel)
iRow = Evaluate("=Count(dataentri!b:b)") + 6
'copy data
ws.Cells(iRow, 2).Value = Me.txtTGL.Value
ws.Cells(iRow, 3).Value = Me.txtMRIS.Value
ws.Cells(iRow, lCol).Value = Me.txtJUMLAH.Value
'hapus data
Me.txtTGL.Value = ""
Me.txtMRIS.Value = ""
Me.txtJUMLAH.Value = ""
Me.txtMRIS.SetFocus
If IsEmpty(ws.Cells(6, 1)) Then
ws.Cells(6, 1) = 1
Sheet1.Range("L6:L14").Formula = "=Sum(d6:k6)"
Sheet1.Range("d15:L15").Formula = "=Sum(d6:d13)"
Sheet1.Calculate
Sheet1.Range("L6:L14").Value = Sheet1.Range("L6:L14").Value
Sheet1.Range("d15:L15").Value = Sheet1.Range("d15:L15").Value
End If
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
________________________________
Dari: Kid Mr. <[email protected]>
Kepada: [email protected]
Dikirim: Senin, 14 Mei 2012 17:01
Judul: Re: [belajar-excel] OPTION BUTTON UNTUK MENENTUKAN LETAK SIMPAN
Coba anda copas hasil pengubahan script Anda
Untuk format angka, blok cell di worksheet, klik kanan,
pilih format cells -> number -> Number -> ganti isian Decimal Places dengan 0
-> OK
Kid.
2012/5/14 achmad adi <[email protected]>
>
>terima kaih sebelumnya Mr. kid,,,heee,,,,
>untuk pertamakali edit data ,,,SUMTOTAL,,bekerja dengan baik,,,tetapi itu
>hanya Kolom pertama (010) aja yang ketotal,,,lainnya gak bisa
>trus kalo hasil Total, 2 angka dibelakang koma Langsung Pembulatan,,,tidak
>ada komanya,,
>
>
>untuk edit kedua kalinya,,,malah gak ketotal semua,,,,
>
>
>
>
>________________________________
>
>