PatriceKas
XLDnaute Nouveau
Bonjour chers membres
je viens s'il vous plait solliciter votre aide je suis entrain de travailler sur un userform qui est en pieces jointes. en fait, le userform comporte un multipages a trois pages et chaque page contient differentes informations qui seront stockes dans trois sheets differents mais chaque page fonctionnera independament de l'autre.
je vous en pries quelqu'un pourrais m'aider avec le code
Option Explicit
Private Sub cmdAdd_Click()
'variables
Dim lRow As Long
Dim lStock As Long
Dim lUnity As Long
Dim lDeliver As Long
Dim lAcquitter As Long
Dim colTexBoxNombre As Collection
Dim ConstChaineNombre As String
Dim ws As Worksheet
Set ws = Worksheets("OrasRequisitionDATA")
'get first row in DataBase
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
lStock = Me.CboStockcode.ListIndex
'check data
'copy data
With ws
.Cells(lRow, 1).Value = Me.txtTrackingDate.Value
.Cells(lRow, 2).Value = Me.txtReqNumber.Value
.Cells(lRow, 3).Value = Me.txtRequesterName.Value
.Cells(lRow, 4).Value = Me.txtCostCenter.Value
.Cells(lRow, 5).Value = Me.CboStockcode.Value
.Cells(lRow, 6).Value = Me.CboStockcode.List(lStock, 1)
.Cells(lRow, 7).Value = Me.txtQuantityIssued.Value
.Cells(lRow, 8).Value = Me.CboUnity.Value
.Cells(lRow, 9).Value = Me.CboDeliver.Value
.Cells(lRow, 10).Value = Me.txtReceiverName.Value
.Cells(lRow, 11).Value = Me.CboAcquitter.Value
End With
'clear data in form
Me.txtTrackingDate.Value = Format(Date, "medium date")
Me.txtReqNumber.Value = ""
Me.txtRequesterName.Value = ""
Me.txtCostCenter.Value = ""
Me.CboStockcode.Value = ""
Me.txtQuantityIssued.Value = 1
Me.CboUnity.Value = ""
Me.CboDeliver.Value = ""
Me.txtReceiverName.Value = ""
Me.CboAcquitter.Value = ""
Me.txtTrackingDate.SetFocus
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim cStock As Range
Dim cUnity As Range
Dim ws As Worksheet
Set ws = Worksheets("LookupLists")
For Each cStock In ws.Range("A2:A656")
With Me.CboStockcode
.AddItem cStock.Value
.List(.ListCount - 1, 1) = cStock.Offset(0, 1).Value
End With
Next cStock
For Each cUnity In ws.Range("D2😀656")
With Me.CboUnity
.AddItem cUnity.Value
End With
Next cUnity
Me.txtTrackingDate = Format(Date, "medium date")
Me.txtQuantityIssued = 1
Me.txtTrackingDate.SetFocus
End Sub
je viens s'il vous plait solliciter votre aide je suis entrain de travailler sur un userform qui est en pieces jointes. en fait, le userform comporte un multipages a trois pages et chaque page contient differentes informations qui seront stockes dans trois sheets differents mais chaque page fonctionnera independament de l'autre.
je vous en pries quelqu'un pourrais m'aider avec le code
Option Explicit
Private Sub cmdAdd_Click()
'variables
Dim lRow As Long
Dim lStock As Long
Dim lUnity As Long
Dim lDeliver As Long
Dim lAcquitter As Long
Dim colTexBoxNombre As Collection
Dim ConstChaineNombre As String
Dim ws As Worksheet
Set ws = Worksheets("OrasRequisitionDATA")
'get first row in DataBase
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
lStock = Me.CboStockcode.ListIndex
'check data
'copy data
With ws
.Cells(lRow, 1).Value = Me.txtTrackingDate.Value
.Cells(lRow, 2).Value = Me.txtReqNumber.Value
.Cells(lRow, 3).Value = Me.txtRequesterName.Value
.Cells(lRow, 4).Value = Me.txtCostCenter.Value
.Cells(lRow, 5).Value = Me.CboStockcode.Value
.Cells(lRow, 6).Value = Me.CboStockcode.List(lStock, 1)
.Cells(lRow, 7).Value = Me.txtQuantityIssued.Value
.Cells(lRow, 8).Value = Me.CboUnity.Value
.Cells(lRow, 9).Value = Me.CboDeliver.Value
.Cells(lRow, 10).Value = Me.txtReceiverName.Value
.Cells(lRow, 11).Value = Me.CboAcquitter.Value
End With
'clear data in form
Me.txtTrackingDate.Value = Format(Date, "medium date")
Me.txtReqNumber.Value = ""
Me.txtRequesterName.Value = ""
Me.txtCostCenter.Value = ""
Me.CboStockcode.Value = ""
Me.txtQuantityIssued.Value = 1
Me.CboUnity.Value = ""
Me.CboDeliver.Value = ""
Me.txtReceiverName.Value = ""
Me.CboAcquitter.Value = ""
Me.txtTrackingDate.SetFocus
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim cStock As Range
Dim cUnity As Range
Dim ws As Worksheet
Set ws = Worksheets("LookupLists")
For Each cStock In ws.Range("A2:A656")
With Me.CboStockcode
.AddItem cStock.Value
.List(.ListCount - 1, 1) = cStock.Offset(0, 1).Value
End With
Next cStock
For Each cUnity In ws.Range("D2😀656")
With Me.CboUnity
.AddItem cUnity.Value
End With
Next cUnity
Me.txtTrackingDate = Format(Date, "medium date")
Me.txtQuantityIssued = 1
Me.txtTrackingDate.SetFocus
End Sub