Probleme de recuperation de Texbox
Bonjour
J'ai le code suivant:
Je recupere le texbox dans la feuille en cours, mais je n'arrive pas a le recuperer dans une autre feuille, je recupere bien le dtpicker.
j'ai mis en rouge l'endroit ou le code ne fonctionne plus
si quelqu'un peu me dire dans ce code, comment faire pour ne pas faire
de .select, car j'ai encore la mauvaise habitude d'utilise ceci, mais je ne sais comment faire
merci
cris
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| Private Sub CommandButton1_Click()
Dim Sh As Worksheet
Dim i As Integer
If Controls("Textbox1") = "" Then
MsgBox "Vous devez ABSOLUMENT indiquer Un Nom !", vbExclamation, _
"ERREUR ... Entrez un Nom SVP !"
Controls("Textbox1").SetFocus
Exit Sub
End If
Application.ScreenUpdating = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
Selection.Merge
Selection = UserForm1.Textbox1
Unload UserForm1
With Selection.Interior
.Color = 65535
End With
With Selection.Font
.ColorIndex = xlAutomatic
Selection.Font.Bold = True
End With
'#--------------------------------------------------
For Each Sh In Worksheets(Array("janv", "fevr", "mars", "Avr", "Mai", "Juin", "Juil", "Aout", "Sept", "Oct", "Nov", "Dec"))
With Sh
For i = 9 To 73
.Range("B" & i) = 0
If .Range("C" & i).Interior.Color = 65535 Then .Range("B" & i) = .Range("B" & i) + 0.25
If .Range("K" & i).Interior.Color = 65535 Then .Range("B" & i) = .Range("B" & i) + 0.25
If .Range("R" & i).Interior.Color = 65535 Then .Range("B" & i) = .Range("B" & i) + 0.25
If .Range("Y" & i).Interior.Color = 65535 Then .Range("B" & i) = .Range("B" & i) + 0.25
Next i
End With
Next Sh
Sheets("recap_clients").Select
[B3] = UserForm1.Textbox1
[C3] = UserForm1.DTPicker1.Value
Rows("3:3").Select
Selection.Insert Shift:=xlDown
Application.ScreenUpdating = True
End Sub |