Copy & paste

averstraeten

New Member
Joined
Aug 25, 2003
Messages
2
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
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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
 
Upvote 0
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 ?
Test.htm
CDEFGH
16An 1An 2
17Cisco 269124 555,000,00792,39792,39
18Frais d'installation1 000,00
19Gestion et MaintenanceCisco 26911 416,671 416,67
20
21TOTAUX MENSUELS2 209,062 209,06
22
23
24Totaux par anne1 000,000,0026 508,6826 508,68
25
26Total pour48mois106 034,71
27
28
29
30
31Mensuel contrat 48 mois
32PrixA la rceptionAn 1An 2
33
34Cisco 2691245550,00792,39792,39
35Frais d'installation1 000,00
36
37TOTAUX MENSUELS1 000,000,00792,39792,39
38
39
40
41
42Gestion et MaintenanceCisco 26911 416,671 416,67
43
44TOTAUX MENSUELS0,000,001 416,671 416,67
Equipements
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top