macro to copy cells from random row to another worksheet

nono

New Member
Joined
May 3, 2010
Messages
7
****** http-equiv="Content-Type" content="text/html; charset=utf-8">****** name="ProgId" content="Word.Document">****** name="Generator" content="Microsoft Word 9">****** name="Originator" content="Microsoft Word 9"><link rel="File-List" href="file:///C:/DOCUME%7E1/Bert/LOCALS%7E1/Temp/msoclip1/01/clip_filelist.xml"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:DoNotOptimizeForBrowser/> </w:WordDocument> </xml><![endif]--><style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; mso-bidi-font-size:12.0pt; font-family:Arial; mso-fareast-font-family:"Times New Roman";} pre {margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Courier New"; mso-fareast-font-family:"Courier New";} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> Hello,
<!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p>
What I would like to do with this macro:
- selection of a random row by myself on worksheet A
- selection / copy of different cells from that row
- selection of a random row by myself on worksheet B
- pasting contents of selected cells from A to the same cells on B
- again back to A, select row, select cells, ….., etc.
<!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p>
Thanks a lot
 
Indeed with this additional “Error” line the run-time error has gone.
But the result is the same: the copy area contains empty cells,
but after selection of the paste range the cells are grouped together
and there are no empty cells between the pasted cells.

Is there a method to maintain the “format” of the copied area?
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try this... maybe works... or maybe no...
Code:
Sub selezione()
Dim rng, rnge As Range
On Error Resume Next
Set rng = Application.InputBox(Prompt:="Selezione intervallo:", _
Title:="Intervallo da copiare", Type:=8)
Set rnge = Application.InputBox(Prompt:="Selezione intervallo:", _
Title:="Intervallo in cui copiare", Type:=8)
rng.Select
Selection.Copy
rnge.Select
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
        , SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
 
Upvote 0
I have tried your idea but unfortunately it doesn´t work.
When I try to paste the selected range nothing happens.
The selected paste range remains empty.
Thanks for your effort.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

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