S
stef51
Guest
Soirbon le forum,
Voila j'ai une macro qui marche utilisée seule !
Mais des lors que je l'utilise depuis une autre en faisant un appel style
Call ranger
end sub
Ca coince ?!!
avez vous une soluce ?
Merci
Private lig As Long, lig2 As Long
Sub ranger()
Dim cesure As Byte
Dim numero As String, client As String
'séparation numero et nom client
client = Cells(lig, 5)
cesure = Application.Search("-", client)
numero = Left(client, cesure - 1)
client = Right(client, Len(client) - cesure)
Range(Cells(lig + 5, 1), Cells(lig2 - 2, 1)) = numero
Range(Cells(lig + 5, 2), Cells(lig2 - 2, 2)) = client
End Sub
Sub affecter()
Dim cellule As Range
Dim dep_address As String
Columns("A:B").ClearContents
Application.ScreenUpdating = False
'd'après aide MS sur find
With ActiveSheet.Range("E1:E65536")
Set cellule = .Find("*", LookIn:=xlValues)
If Not cellule Is Nothing Then
dep_address = cellule.Address
Do
lig = cellule.Row
Set cellule = .FindNext(cellule)
lig2 = cellule.Row
If lig2 < lig Then
lig2 = Range("D65536").End(xlUp).Row + 2
End If
ranger
Loop While Not cellule Is Nothing And cellule.Address <> dep_address
End If
End With
End Sub
Voila j'ai une macro qui marche utilisée seule !
Mais des lors que je l'utilise depuis une autre en faisant un appel style
Call ranger
end sub
Ca coince ?!!
avez vous une soluce ?
Merci
Private lig As Long, lig2 As Long
Sub ranger()
Dim cesure As Byte
Dim numero As String, client As String
'séparation numero et nom client
client = Cells(lig, 5)
cesure = Application.Search("-", client)
numero = Left(client, cesure - 1)
client = Right(client, Len(client) - cesure)
Range(Cells(lig + 5, 1), Cells(lig2 - 2, 1)) = numero
Range(Cells(lig + 5, 2), Cells(lig2 - 2, 2)) = client
End Sub
Sub affecter()
Dim cellule As Range
Dim dep_address As String
Columns("A:B").ClearContents
Application.ScreenUpdating = False
'd'après aide MS sur find
With ActiveSheet.Range("E1:E65536")
Set cellule = .Find("*", LookIn:=xlValues)
If Not cellule Is Nothing Then
dep_address = cellule.Address
Do
lig = cellule.Row
Set cellule = .FindNext(cellule)
lig2 = cellule.Row
If lig2 < lig Then
lig2 = Range("D65536").End(xlUp).Row + 2
End If
ranger
Loop While Not cellule Is Nothing And cellule.Address <> dep_address
End If
End With
End Sub