Copy & paste

Thanks:  0
Likes:  0

1. ## Copy & paste

Hi there,

Here is my big problem.

I create a 3 lines result with a calculus. Let say line 10 to 12
What I want with a macro is when you push on the button, the 2 first line are copied and pasted on line 30 and 31.The third one is copied on line 40.
That works ok with a macro. The problem is when I try the second time the macro. I would like that the next result, always on line 10 to 12 is copied and pasted on line 32 and 33 AND at the same time, a line is inserted and line 12 is copied after line 40 which is now 43 becaus of lines inserted.
I hope I was clear enough.

Thanks for any suggestion.

Bonjour,

Voici mon problème: Dans l'onglet équipement, une fois le calcul de l'équipement effectué, j'appuie sur le bouton ajouter une pièce d'équipement ce qui a pour effet d'ajouter deux lignes dans le premier cadre plus bas, ligne 33-34 et une ligne pour la maintenance ligne 42. Cela fonctionne très bien pour le premier ajout. C'est à partir du second que ça ne fonctionne plus, au deuxième ajout la maintenance ne s'ajoute pas au bon endroit.

Des suggestions ???

Merci d'avance, Alain

2. hello averstraeten,

First welcome to the board!
I Think this is what you wanted. At least you can puzzle with this (Sorry don't know how to write it in france sometimes i can't even do it english.) Keep posting

Sub Monkey()
Rows("10:11").Copy
If Range("A30") = "" Then
Range("A30").PasteSpecial
Else
Range("A30").End(xlDown).Offset(1, 0).PasteSpecial
End If
Rows("12:12").Copy
If Range("A40") = "" Then
Range("A40").PasteSpecial
Else
If Range("A41") = "" Then
Range("A41").PasteSpecial
Else
Range("A40").End(xlDown).Offset(1, 0).PasteSpecial
End If
End If

End Sub

Greetings,

Monkey

3. ## Re: Copy & paste

It is not working unfortunately.

I try to explain my problem again. Line 17-18 I got the component and his prices. Line 19 is the maintenance price.
When I click on a button associate with a macro, I copy the first 2 lines at line 34 and 35 and I copy line 19 at line 42.
The problem is comming when I want to add a new component. it is ok for line 34 and 35 because I insert always two new lines. I am not able tos add the line 19 next or before line 42 which is now 45.
Any idea ?

******** ******************** ************************************************************************>
 Microsoft Excel - Test.htm ___Running: xl2002 XP : OS = Windows XP
 (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)bout
 C17D17E17G17H17E18D19G19H19G21H21E24F24G24H24D26G26E37F37G37H37E44F44G44H44 =

C
D
E
F
G
H
16
An 1An 2
17
Cisco 269124 555,000,00 792,39 792,39
18
Frais d'installation 1 000,00
19
Gestion et MaintenanceCisco 2691 1 416,67 1 416,67
20
21
TOTAUX MENSUELS 2 209,06 2 209,06
22
23
24
Totaux par année1 000,00 0,00 26 508,68 26 508,68
25
26
Total pour 48mois 106 034,71
27
28
29
30
31
Mensuel contrat 48 mois
32
PrixA la réception An 1An 2
33
34
Cisco 2691245550,00 792,39 792,39
35
Frais d'installation 1 000,00
36
37
TOTAUX MENSUELS 1 000,00 0,00 792,39 792,39
38
39
40
41
42
Gestion et MaintenanceCisco 2691 1 416,67 1 416,67
43
44
TOTAUX MENSUELS 0,00 0,00 1 416,67 1 416,67
 Equipements

[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.

## User Tag List

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•