Am vazut in articolul anterior cum putem sa introducem datele intr-o fila din Excel printr-o interfata vizuala prietenoasa, dar cum putem sa vedem datele introduse, in aceeasi maniera? Ei bine asta vom dezvolta in acest tutorial.
Avem toate pregatirile in articolul anterior (cum deschidem interfata vizuala, cum introducem codul si explicatiile de baza) pentru a putea incepe.
Tabel excel:
Nr_inregistrare | Nume | Judet | Localitate | Strada | Numar | CNP_CUI | P_abs | Stadiu | Data | Data1 | Lucrare |
1 | Albahar | Ilfov | Costesti | Pinului | 27 | 6656454 | 16 | Plan atasat | 5/20/2018 | Client ATR | 5 |
2 | Alistar | Bucuresti | Sector 1 | Dudului | 28 | 213837 | 24 | Avize CU obtinute | 5/20/2018 | Dezvoltator | 6 |
3 | Total | Ilfov | Rosu | Lidului | 29 | 181382 | 1342 | Avize CU obtinute | 5/20/2018 | Deviere | 7 |
4 | Compact | Ilfov | Cochirleni | Buriceni | 30 | 412124412 | 5 | Cerere inregistrata | 5/20/2018 | Client ATR | 7 |
5 | Genorium | Ilfov | Coco | Bubu | 2 | 412124412 | 5 | Cerere inregistrata | 5/20/2018 | Client ATR | 7 |
Private Sub Verifica_Click()
'Functie Verifica lucrare
Dim dDate As Date
Dim Interval As Range
Dim Rng As Range
Dim Lookup As String
Dim Done As Boolean
On Error GoTo ErrHand
If Not TextBox1.Value = "" Then
With Application.WorksheetFunction
d = .Match(CLng(TextBox1.Value), Worksheets("Sheet1").Range("A:A"), 0)
End With
Else
ErrHand:
MsgBox ("Introdu un numar corect de cerere")
For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "TextBox"
ctl.Text = ""
Case "CheckBox", "OptionButton", "ToggleButton"
ctl.Value = False
ctl.BackColor = &HC0E0FF
Case "ComboBox", "ListBox"
ctl.ListIndex = -1
End Select
Next ctl
GoTo ErrorHandler
End If
If WorksheetFunction.CountIf(Sheets("Sheet1").Range("A:A"), Me.TextBox1) = 0 Then
MsgBox "Nu exista aceasta lucrare"
Me.TextBox1.Value = ""
Exit Sub
End If
With Me
lrCD1 = Sheets("Sheet1").Range("L" & Rows.Count).End(xlUp).Row
'Vlookup dupa campul Reg1 (ex: nr inregistrare in tabel Lookup din sheet baza coloana (2) -> Lookup incepe din coloana B deci index2 va fi coloana 3
Dim Jd
Dim loc
Dim str
Dim nr
Jd = Cells(d, 3)
loc = Cells(d, 4)
str = Cells(d, 5)
nr = Cells(d, 6)
TextBox2 = Cells(d, 2)
TextBox3 = Cells(d, 11)
TextBox4 = Jd & "," & loc & "," & str & "," & nr
TextBox5 = Cells(d, 7)
'dDate = DateSerial(Year(Date), Month(Date), Day(Date))
' TextBox5.Value = Format(Reg4.Value, "dd/mm/yyyy")
' dDate = TextBox5.Value
TextBox7= Cells(d, 8)
TextBox6 = Cells(d, 9)
End With
ErrorHandler:
End Sub
PS:Pentru ajutor, intrebari sau colaborari ma puteti contacta in privat sau in comentarii :-).
0 comentarii:
Trimiteți un comentariu