Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public AnggaranAwal
- Private Sub cmdLOOKUP_Click()
- Dim findvalue as range, findvalue3 As Range
- If not Me.ComboBox1.Value = vbnullstring Then
- Set findvalue3 = Sheet2.Range("A:A").Find(what:=Me.ComboBox1.Value, LookIn:=xlFormulas, lookAt:=xlWhole)
- If WorksheetFunction.CountIf(Sheets("sheet2").Range("A:A"), Me.ComboBox1.Text) > 0 Then
- with findvalue3
- Me.txtINPUT.Value = .Value
- 'misal anggaran adalah ini
- AnggaranAwal = .Value
- Me.txtURAIANBELANJA.Value = .Offset(0, 2).Value
- Me.txtREALISASI.Value = Format(.Offset(0, 3).Value, "#,##")
- 'misal anggaran adalah ini
- AnggaranAwal = .Offset(0, 3).Value
- Me.txtKODEREK.Value = .Offset(0, 4).Value
- Me.TextBox1 = vbnullstring
- end with
- Else
- MsgBox "Data tidak ditemukan"
- Call BersihForm
- End If
- End If
- End Sub
- 'Misal Anggaran ada di txtINPUT
- Private Sub txtREALISASI_Exit(ByVal Cancel As MSForms.ReturnBoolean)
- 'Ambil ulang value nya
- With Sheet2.Range("A:A")
- Set c = .Find(ComboBox1.Value, lookin:=xlValues)
- If Not c Is Nothing Then
- AnggaranAwal = c.Offset(0, 3).Value
- End If
- End With
- if txtINPUT.value > AnggaranAwal then
- 'kalau masih error coba conver ke long jadi
- 'if Clng(txtINPUT.value) > AnggaranAwal then
- msgbox "MOHON DIPERIKSA KEMBALI HASIL INPUTAN MELEBIHI ANGGARAN"
- end if
- end Sub
- Private Sub BersihForm
- Me.txtINPUT = vbnullstring
- Me.txtNOMOR = vbnullstring
- Me.txtTANGGAL = vbnullstring
- Me.txtBELANJA = vbnullstring
- Me.txtURAIANBELANJA = vbnullstring
- Me.txtREALISASI = vbnullstring
- Me.txtNOREKENING = vbnullstring
- Me.txtPENERIMA = vbnullstring
- Me.txtNOTELEPON = vbnullstring
- Me.txtKODEREK = vbnullstring
- end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement