Coba hapus End IF sebelum End Sub pada prosedur event click milik cmdtambah

Wassalam,
Kid.

On Mon, May 14, 2012 at 5:09 PM, achmad adi <[email protected]> wrote:

> **
>
>
> 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
>
>
>   ------------------------------
> **
>

Kirim email ke