Modifier code vba
Fermé
teckmicro
Messages postés
89
Date d'inscription
vendredi 7 mars 2008
Statut
Membre
Dernière intervention
15 avril 2018
-
26 sept. 2013 à 17:36
teckmicro Messages postés 89 Date d'inscription vendredi 7 mars 2008 Statut Membre Dernière intervention 15 avril 2018 - 30 sept. 2013 à 09:28
teckmicro Messages postés 89 Date d'inscription vendredi 7 mars 2008 Statut Membre Dernière intervention 15 avril 2018 - 30 sept. 2013 à 09:28
A voir également:
- Modifier code vba
- Modifier dns - Guide
- Modifier liste déroulante excel - Guide
- Comment modifier un pdf - Guide
- Code asci - Guide
- Modifier code pin - Guide
2 réponses
teckmicro
Messages postés
89
Date d'inscription
vendredi 7 mars 2008
Statut
Membre
Dernière intervention
15 avril 2018
26 sept. 2013 à 17:38
26 sept. 2013 à 17:38
..... suite voici le Code a Modifier
Option Explicit
Private Sub ComboBox1_Click()
Dim i As Byte
CommandButton3.Visible = True
CommandButton4.Visible = True
Label27.Caption = "mode : Modification"
With ComboBox1
For i = 1 To 22
Controls("TextBox" & i) = Sheets("feuil1").Cells(.List(.ListIndex, 1), i)
Next i
End With
End Sub
Private Sub CommandButton1_Click()
Dim Dl As Long
Dim x As Byte
With Sheets("Feuil1")
.Activate
Dl = .Range("A65536").End(xlUp).Row + 1
For x = 1 To 22
.Cells(Dl, x).Value = Me.Controls("TextBox" & x).Value
Next x
Unload Me
'tri selon le nom
.Range("A1").CurrentRegion.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub CommandButton3_Click()
Dim i As Byte
With ComboBox1
For i = 1 To 22
Sheets("feuil1").Cells(.List(.ListIndex, 1), i) = Controls("TextBox" & i)
Controls("TextBox" & i) = ""
Next i
.ListIndex = -1
End With
CommandButton3.Visible = False
CommandButton4.Visible = False
Label27.Caption = "mode : création"
initialisecombo
End Sub
Private Sub CommandButton4_Click()
Dim i As Byte
With ComboBox1
For i = 1 To 22
Controls("TextBox" & i) = ""
Next i
.ListIndex = -1
End With
CommandButton3.Visible = False
CommandButton4.Visible = False
Label27.Caption = "mode : création"
End Sub
Private Sub Frame4_Click()
End Sub
Private Sub Frame5_Click()
End Sub
Private Sub Label27_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub UserForm_Initialize()
Label27.Caption = "mode : création"
initialisecombo
End Sub
Public Sub initialisecombo()
Dim i As Integer
With ComboBox1
.Clear
.ColumnCount = 2
.ColumnWidths = "50;0"
End With
With Sheets("feuil1")
For i = 2 To .Range("a65536").End(xlUp).Row
ComboBox1.AddItem
ComboBox1.List(ComboBox1.ListCount - 1, 0) = .Cells(i, 1)
ComboBox1.List(ComboBox1.ListCount - 1, 1) = i
Next i
End With
End Sub
Cordialement
Option Explicit
Private Sub ComboBox1_Click()
Dim i As Byte
CommandButton3.Visible = True
CommandButton4.Visible = True
Label27.Caption = "mode : Modification"
With ComboBox1
For i = 1 To 22
Controls("TextBox" & i) = Sheets("feuil1").Cells(.List(.ListIndex, 1), i)
Next i
End With
End Sub
Private Sub CommandButton1_Click()
Dim Dl As Long
Dim x As Byte
With Sheets("Feuil1")
.Activate
Dl = .Range("A65536").End(xlUp).Row + 1
For x = 1 To 22
.Cells(Dl, x).Value = Me.Controls("TextBox" & x).Value
Next x
Unload Me
'tri selon le nom
.Range("A1").CurrentRegion.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub CommandButton3_Click()
Dim i As Byte
With ComboBox1
For i = 1 To 22
Sheets("feuil1").Cells(.List(.ListIndex, 1), i) = Controls("TextBox" & i)
Controls("TextBox" & i) = ""
Next i
.ListIndex = -1
End With
CommandButton3.Visible = False
CommandButton4.Visible = False
Label27.Caption = "mode : création"
initialisecombo
End Sub
Private Sub CommandButton4_Click()
Dim i As Byte
With ComboBox1
For i = 1 To 22
Controls("TextBox" & i) = ""
Next i
.ListIndex = -1
End With
CommandButton3.Visible = False
CommandButton4.Visible = False
Label27.Caption = "mode : création"
End Sub
Private Sub Frame4_Click()
End Sub
Private Sub Frame5_Click()
End Sub
Private Sub Label27_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub UserForm_Initialize()
Label27.Caption = "mode : création"
initialisecombo
End Sub
Public Sub initialisecombo()
Dim i As Integer
With ComboBox1
.Clear
.ColumnCount = 2
.ColumnWidths = "50;0"
End With
With Sheets("feuil1")
For i = 2 To .Range("a65536").End(xlUp).Row
ComboBox1.AddItem
ComboBox1.List(ComboBox1.ListCount - 1, 0) = .Cells(i, 1)
ComboBox1.List(ComboBox1.ListCount - 1, 1) = i
Next i
End With
End Sub
Cordialement
teckmicro
Messages postés
89
Date d'inscription
vendredi 7 mars 2008
Statut
Membre
Dernière intervention
15 avril 2018
30 sept. 2013 à 09:28
30 sept. 2013 à 09:28
.