Macro qui fonction sur la selection numero 118 mai changement n

Fermé
gomido - 25 janv. 2013 à 17:41
chossette9 Messages postés 4239 Date d'inscription lundi 20 avril 2009 Statut Contributeur Dernière intervention 12 septembre 2014 - 25 janv. 2013 à 18:46
Bonjour,


Public Sub copideuxenun2



Public Sub copideuxenun2()
Application.ScreenUpdating = False

Dim Y As Long
''Dim k As Integer

''Dim L As Integer
''Dim A As String
Dim F As Range
Dim g As Range
Dim confirmvaleur As String
Dim valeurech As String
Dim Enregmodif As Long

Dim valeurmodif As String

Dim i As Long

'******************************
Sheet1.Activate
'*******************************
Enregmodif = InputBox("entrer le nombre de ligne sélectionnée :")

confirmvaleur = InputBox("Merci de saisir la valeur du numero du groupe s'il vous plait :")
valeurmodif = InputBox("entrer la modification de la zone statut :")

Y = 0

For i = 0 To ListBox1.ListCount - 1




Do While ListBox1.Selected(i) = True

ListBox1.Selected(i) = ListBox1.Selected(i) + 1

Y = Y + 1

'***************************************************

Set F = Sheet1.Range("A5:H500").Find(what:=confirmvaleur, LookIn:=xlValues, lookat:=xlWhole)

F.Offset(0, 4).Value = valeurmodif

MsgBox (" Valeur F reche feuille de diffusion :") & F.Value

'*******


'MsgBox ("rows addresse :") & Sheet1.Rows(i).Address

'******************************************************
Sheet23.Activate
Dim K As Range

'******************************
Set g = Sheet23.Range("A5:H500").Find(what:=confirmvaleur, LookIn:=xlValues)



Set K = Sheet23.Range("A5:H500").Find(what:=g.Offset(0, 2).Value, LookIn:=xlValues)






MsgBox (" valeur recherche g:") & g.Value
'MsgBox (" valeur recherche g adresse :") & g.Address



MsgBox (" valeur recherche k:") & K.Value
'MsgBox (" valeur recherche k adresse :") & K.Address


If Not K Is Nothing Then
Dim m As Range
K.Select


''''k.Offset(0, 2).Value = valeurmodif

''selection.Rows(i).Select
'MsgBox (" valeur recherche Sheet23 cells(i-2,6:") & Sheet23.Cells(i - 2, 6).Value

'' Sheet23.Cells(i - 4, 6).Select
'''k.Offset(0, 2).Select
'' Sheet23.Cells(i + 1, 6).Rows.Select

'MsgBox (" valeur recherche Sheet23 cells(i+1,3:") & Sheet23.Cells(i + 1, 3).Value

'MsgBox (" valeur Sheet23 cells(i+1,4:") & Sheet23.Cells(i + 1, 4).Value



'MsgBox (" valeur Sheet23 cells(i+1,4 )offset(0,4):") & Sheet23.Cells(i + 1, 4).Offset(0, 4).Value

'MsgBox (" valeur Sheet23 cells(i+1,4 )offset(0,2):") & Sheet23.Cells(i + 1, 4).Offset(0, 2).Value
'MsgBox (" valeur Sheet23 cells(i-3,5 )") & Sheet23.Cells(i - 3, 5).Value

'MsgBox (" valeur Sheet23 cells(i-3,6 )") & Sheet23.Cells(i - 3, 6).Value
MsgBox (" valeur Sheet23.Cells(i - 3, 6).Offset(0, 2)") & Sheet23.Cells(i - 3, 6).Offset(0, 2).Value


Dim ancienValStatut As String

ancienValStatut = Sheet23.Cells(i - 3, 6).Offset(0, 2).Value
Sheet23.Cells(i - 3, 6).Offset(0, 2) = valeurmodif
'*************
Sheet23.Cells(i - 3, 6).Select
selection.EntireRow.Activate
selection.EntireRow.Copy
selection.EntireRow.Insert Shift:=xlShiftDown
'***********
'*remettre l'ancien valeur de la zone statust
'***
Sheet23.Cells(i - 3, 6).Offset(0, 2).Value = ancienValStatut
'****************************************************





End If
'*********************************************************
Do

ListBox1.Selected(i) = ListBox1.Selected(i) + 1

Y = Y + 1
i = i + 1

Sheet23.Cells(i - 3, 6).Offset(1, 0).Select

selection.EntireRow.Copy
selection.EntireRow.Insert Shift:=xlShiftDown

'*******************************
MsgBox (" valeur Sheet23.Cells(i - 3, 6).Offset(1, 0)") & Sheet23.Cells(i - 3, 6).Offset(1, 0).Value

'************************************************
'************************************************

ListBox1.Selected(i) = ListBox1.Selected(i) + 1

i = i + 1

'**************************
MsgBox ("valeur Y :") & Y


Loop Until Y = Enregmodif
'***************************************

'*********************************

MsgBox ("LES LIGNES CONCERNANT LE GROUPE SELECTIONE SONT COPIEES :")


'**********
i = i + 1

Loop


Next i


Application.ScreenUpdating = True

End Sub



A voir également:

1 réponse

chossette9 Messages postés 4239 Date d'inscription lundi 20 avril 2009 Statut Contributeur Dernière intervention 12 septembre 2014 1 306
25 janv. 2013 à 18:46
Bonsoir,

je vous aurais bien aidé. Hélas ma boule de cristal est tombée en panne ce matin, et mes dons de divinations ne sont plus aussi bons qu'avant...

Quelques explications seraient les bienvenues pour comprendre le soucis.

Cordialement.
0