Deleting Range without formating of cells

Martin1991

New Member
Joined
Nov 14, 2017
Messages
24
Hello.
I am using simple macro to copy some Values onto another sheets of another workbooks. But before paste of Values i need to delete remaining Values in COPYpath workbook.
And here came the problem, because i need to vba not to clear values including format of page. In workbook, where i copy to, is format, where the "A column" has original format, but columns "B-E" have greater Width.
But after deleting of original data, the vba format mentioned Columns to same Width as is in "A Column"

adding only the part of copy, paste code.

Code:
Db.Activate ´Db is just defined WorkBookRange("A1:E1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Delete
wb.Activate
obl2.Columns(3).SpecialCells(xlCellTypeVisible).Copy
Db.Activate
Db.Worksheets("Sheet1").Range("B1").Paste

There is problem with paste part aswell,(438-object doesnt support this property of method). I tried more ways, how to declare the Range i needed; Same bug with codes:
Code:
Worksheets("Sheet1").Range("B1").Paste
Code:
Worksheets("Sheet1").Range("B1").Select
Selection.Paste

Does it needs some kind of pasteSpecial since i copy only visible cells?

Please help to advise, how to fix it.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
have you tried:

Code:
 Range("A1:E1").Select   
 Range(Selection, Selection.End(xlDown)).Select
    Selection = ""
 
Last edited:
Upvote 0
Ok, of course it works. And i wonder it did not come to my mind. How simple.

Thanks!

Any Ideas about the paste part?
 
Upvote 0
I know it is basic for beginners. But still couldn´t handle it out and find the solution aswell.

Now it works with (and i realize, there are more methods, how to make it works):
Code:
Range("B1").PasteSpecial xlPasteAll
In advance someone will look up about same issue.

One more time thanks, offthelip, for reminding, that sometimes it is enaugh to turn on brain. :)
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

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