Resize selection and copy it to another workbook

Bneder

New Member
Joined
Oct 11, 2018
Messages
9
Hi, i use excel macros about half a year and 99% of them I created myself, but now I'm stuck. ( I have about 30 macros )

Problem :

I need to copy only some rows from my chart to another workbook.
I hold CTRL and select for example B2 B6 and B10 then i need to resize selection by 8 columns to right side and copy this to another workbook and paste as values.

I have one working macro, but it causes excel to blink :

Code:
For Each c In Selection        
c.Resize(, 8).Copy


NextFree = Workbooks("Odstránenka závad.xlsm").Sheets("Vstup").Range("M14:M" & Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
        Workbooks("Odstránenka závad.xlsm").Sheets("Vstup").Range("M" & NextFree).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
 Next c


 Application.CutCopyMode = False


 Workbooks("Odstránenka závad.xlsm").Activate
 Range("M" & NextFree).Offset(1).Select

I tried to use Application.Visible = False, but when i set it back to True I got a new empty Excel window. I use Excel 2016 in work.


I tried also send values without clipboard, this was fast and without blinking, but resize do not work so it only copied the values from the "B" column.

Code:
NextFree = Workbooks("Odstránenka závad.xlsm").Sheets("Vstup").Range("M14:M" & Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
For Each c In Selection
    c = c.Resize(, 8)
    Workbooks("Odstránenka závad.xlsm").Worksheets("Vstup").Range("M" & NextFree).Value = c
    NextFree = Workbooks("Odstránenka závad.xlsm").Sheets("Vstup").Range("M14:M" & Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Next c

Can someone pls help me edit second macro ?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi & welcome to MrExcel.
How about
Code:
For Each c In Selection
    Workbooks("Odstránenka závad.xlsm").Worksheets("Vstup").Range("M" & NextFree).Resize(, 8).Value = c.Resize(, 8).Value
    NextFree = Workbooks("Odstránenka závad.xlsm").Sheets("Vstup").Range("M14:M" & Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Next c
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,665
Members
449,045
Latest member
Marcus05

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