OVH Cloud OVH Cloud

+ SIMPLE???

2 réponses
Avatar
Swoap
Bonjour a tous j'ai mis en place une macro qui permet de copier des cellules
vers une feuilles recap.
y a t'il un moyen de faire plus simple?

MERCI d'avance
Emeric

'-----copie valeur cellule/feuille
With Sheets(1)
For ong = 3 To Sheets.Count
.Select
.Cells(ong - 1, 1).Value = Sheets(ong).[E4].Text
ActiveSheet.Hyperlinks.Add Anchor:=.Cells(ong - 1, 2), _
Address:="", SubAddress:=Sheets(ong).Name & "!A1", _
TextToDisplay:=Sheets(ong).Name
.Cells(ong - 1, 3).Value = Sheets(ong).[A8].Text
' Copie Téléphone Siège
.Cells(ong - 1, 4).Value = Sheets(ong).[B8].Text
' Copie E-mail Representant 1
.Cells(ong - 1, 5).Value = Sheets(ong).[D8].Text
' Copie E-mail Representant 2
.Cells(ong - 1, 6).Value = Sheets(ong).[B2].Text
' Copie Nom Representant 1
.Cells(ong - 1, 7).Value = Sheets(ong).[D4].Text
' Copie Nom Representant 2
.Cells(ong - 1, 8).Value = Sheets(ong).[E13].Value
' Copie CA
.Cells(ong - 1, 9).Value = Sheets(ong).[E70].Value
' Copie FACTURE salon
If Cells(ong - 1, 9).Value = 0 Then
.Cells(ong - 1, 9).Value = Sheets(ong).[E71].Value
' Copie FACTURE salon
End If
.Cells(ong - 1, 10).Value = "=RC[-2]*RC[-1]"
' Copie valeur salon
.Cells(ong - 1, 11).Value = Sheets(ong).[E50].Value
' Copie MEA
.Cells(ong - 1, 12).Value = "=RC[-2]*RC[-1]"
' Copie valeur Mea
.Cells(ong - 1, 13).Value = Sheets(ong).[E52].Value
'copie prospectus
.Cells(ong - 1, 14).Value = "=RC[-2]*RC[-1]"
' Copie valeur Prospectus
.Cells(ong - 1, 15).Value = Sheets(ong).[E54].Value
' Copie PAckage Evenementiel
.Cells(ong - 1, 16).Value = "=RC[-2]*RC[-1]"
' Copie valeur pack eve
.Cells(ong - 1, 17).Value = Sheets(ong).[E55].Value
' Copie Prestation logistique
.Cells(ong - 1, 18).Value = "=RC[-2]*RC[-1]"
' Copie valeur prestlog
.Cells(ong - 1, 19).Value = Sheets(ong).[E68].Value
' Copie Precomerch.
.Cells(ong - 1, 20).Value = "=RC[-2]*RC[-1]"
' Copie valeur precomerch
.Cells(ong - 1, 21).Value = Sheets(ong).[E69].Value
' Copie Stats SCA.
.Cells(ong - 1, 22).Value = "=RC[-2]*RC[-1]"
' Copie valeur stats
Next ong
End With

2 réponses

Avatar
JLuc
*Bonjour Swoap*,
A part le For...Next, je vois pas :-(

Bonjour a tous j'ai mis en place une macro qui permet de copier des cellules
vers une feuilles recap.
y a t'il un moyen de faire plus simple?

MERCI d'avance
Emeric

'-----copie valeur cellule/feuille
With Sheets(1)
For ong = 3 To Sheets.Count
.Select
.Cells(ong - 1, 1).Value = Sheets(ong).[E4].Text
ActiveSheet.Hyperlinks.Add Anchor:=.Cells(ong - 1, 2), _
Address:="", SubAddress:=Sheets(ong).Name & "!A1", _
TextToDisplay:=Sheets(ong).Name
.Cells(ong - 1, 3).Value = Sheets(ong).[A8].Text
' Copie Téléphone Siège
.Cells(ong - 1, 4).Value = Sheets(ong).[B8].Text
' Copie E-mail Representant 1
.Cells(ong - 1, 5).Value = Sheets(ong).[D8].Text
' Copie E-mail Representant 2
.Cells(ong - 1, 6).Value = Sheets(ong).[B2].Text
' Copie Nom Representant 1
.Cells(ong - 1, 7).Value = Sheets(ong).[D4].Text
' Copie Nom Representant 2
.Cells(ong - 1, 8).Value = Sheets(ong).[E13].Value
' Copie CA
.Cells(ong - 1, 9).Value = Sheets(ong).[E70].Value
' Copie FACTURE salon
If Cells(ong - 1, 9).Value = 0 Then
.Cells(ong - 1, 9).Value = Sheets(ong).[E71].Value
' Copie FACTURE salon
End If
For x = 10 to 22 Step 2

.Cells(ong - 1, x).Value = "=RC[-2]*RC[-1]"
Next x
' Copie valeur salon
.Cells(ong - 1, 11).Value = Sheets(ong).[E50].Value
' Copie valeur Mea
.Cells(ong - 1, 13).Value = Sheets(ong).[E52].Value
' Copie valeur Prospectus
.Cells(ong - 1, 15).Value = Sheets(ong).[E54].Value
' Copie valeur pack eve
.Cells(ong - 1, 17).Value = Sheets(ong).[E55].Value
' Copie valeur prestlog
.Cells(ong - 1, 19).Value = Sheets(ong).[E68].Value
' Copie valeur precomerch
.Cells(ong - 1, 21).Value = Sheets(ong).[E69].Value
' Copie valeur stats
Next ong
End With


--
____
( O | O )
--
_oooO_ JLuc _Oooo_

O-O

Avatar
Swoap
Merci Jluc c'est déjà des lignes en moins!
Bon WE
"JLuc" a écrit dans le message de news:

*Bonjour Swoap*,
A part le For...Next, je vois pas :-(

Bonjour a tous j'ai mis en place une macro qui permet de copier des
cellules vers une feuilles recap.
y a t'il un moyen de faire plus simple?

MERCI d'avance
Emeric

'-----copie valeur cellule/feuille
With Sheets(1)
For ong = 3 To Sheets.Count
.Select
.Cells(ong - 1, 1).Value = Sheets(ong).[E4].Text
ActiveSheet.Hyperlinks.Add Anchor:=.Cells(ong - 1, 2), _
Address:="", SubAddress:=Sheets(ong).Name & "!A1", _
TextToDisplay:=Sheets(ong).Name
.Cells(ong - 1, 3).Value = Sheets(ong).[A8].Text
' Copie Téléphone Siège
.Cells(ong - 1, 4).Value = Sheets(ong).[B8].Text
' Copie E-mail Representant 1
.Cells(ong - 1, 5).Value = Sheets(ong).[D8].Text
' Copie E-mail Representant 2
.Cells(ong - 1, 6).Value = Sheets(ong).[B2].Text
' Copie Nom Representant 1
.Cells(ong - 1, 7).Value = Sheets(ong).[D4].Text
' Copie Nom Representant 2
.Cells(ong - 1, 8).Value = Sheets(ong).[E13].Value
' Copie CA
.Cells(ong - 1, 9).Value = Sheets(ong).[E70].Value
' Copie FACTURE salon
If Cells(ong - 1, 9).Value = 0 Then
.Cells(ong - 1, 9).Value = Sheets(ong).[E71].Value
' Copie FACTURE salon
End If
For x = 10 to 22 Step 2

.Cells(ong - 1, x).Value = "=RC[-2]*RC[-1]"
Next x
' Copie valeur salon
.Cells(ong - 1, 11).Value = Sheets(ong).[E50].Value
' Copie valeur Mea
.Cells(ong - 1, 13).Value = Sheets(ong).[E52].Value
' Copie valeur Prospectus
.Cells(ong - 1, 15).Value = Sheets(ong).[E54].Value
' Copie valeur pack eve
.Cells(ong - 1, 17).Value = Sheets(ong).[E55].Value
' Copie valeur prestlog
.Cells(ong - 1, 19).Value = Sheets(ong).[E68].Value
' Copie valeur precomerch
.Cells(ong - 1, 21).Value = Sheets(ong).[E69].Value
' Copie valeur stats
Next ong
End With


--
____
( O | O )
--
_oooO_ JLuc _Oooo_

O-O