Advertisement
ba5tz

dari EIUG

Apr 6th, 2019
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.64 KB | None | 0 0
  1. Public AnggaranAwal
  2.  
  3. Private Sub cmdLOOKUP_Click()
  4. Dim findvalue as range, findvalue3 As Range
  5. If not Me.ComboBox1.Value = vbnullstring Then
  6.     Set findvalue3 = Sheet2.Range("A:A").Find(what:=Me.ComboBox1.Value, LookIn:=xlFormulas, lookAt:=xlWhole)
  7.     If WorksheetFunction.CountIf(Sheets("sheet2").Range("A:A"), Me.ComboBox1.Text) > 0 Then
  8.         with findvalue3
  9.             Me.txtINPUT.Value = .Value
  10.             'misal anggaran adalah ini
  11.             AnggaranAwal = .Value
  12.             Me.txtURAIANBELANJA.Value = .Offset(0, 2).Value
  13.             Me.txtREALISASI.Value = Format(.Offset(0, 3).Value, "#,##")
  14.             'misal anggaran adalah ini
  15.             AnggaranAwal = .Offset(0, 3).Value
  16.             Me.txtKODEREK.Value = .Offset(0, 4).Value
  17.             Me.TextBox1 = vbnullstring
  18.         end with
  19.     Else
  20.         MsgBox "Data tidak ditemukan"
  21.         Call BersihForm
  22.     End If
  23. End If
  24. End Sub
  25.  
  26. 'Misal Anggaran ada di txtINPUT
  27. Private Sub txtREALISASI_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  28. 'Ambil ulang value nya
  29. With Sheet2.Range("A:A")
  30.     Set c = .Find(ComboBox1.Value, lookin:=xlValues)
  31.     If Not c Is Nothing Then
  32.         AnggaranAwal = c.Offset(0, 3).Value
  33.     End If
  34. End With
  35. if txtINPUT.value > AnggaranAwal then
  36.     'kalau masih error coba conver ke long jadi
  37.     'if Clng(txtINPUT.value) > AnggaranAwal then
  38.     msgbox "MOHON DIPERIKSA KEMBALI HASIL INPUTAN MELEBIHI ANGGARAN"
  39. end if
  40. end Sub
  41.  
  42. Private Sub BersihForm
  43. Me.txtINPUT = vbnullstring
  44. Me.txtNOMOR = vbnullstring
  45. Me.txtTANGGAL = vbnullstring
  46. Me.txtBELANJA = vbnullstring
  47. Me.txtURAIANBELANJA = vbnullstring
  48. Me.txtREALISASI = vbnullstring
  49. Me.txtNOREKENING = vbnullstring
  50. Me.txtPENERIMA = vbnullstring
  51. Me.txtNOTELEPON = vbnullstring
  52. Me.txtKODEREK = vbnullstring
  53. end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement