formating paste problem

rjointern

New Member
Joined
Aug 16, 2005
Messages
11
Hi,

So I've created some code that will copy and paste data from one worksheet in one workbook to another new worksheet that I have to create. Is there any way to automatically keep the textsize, column spacings, row spacings etc from the data that was copied?

Also the way that i am copying is using the workbook.worksheet.range.copy code, is there any way to not have to use the range and just copy the entire sheet in it's entirety? This would alleviate the issue I think, but I have failed to find the proper coding.

thanks.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Can we see your code?

You can copy an entire worksheet like this.
Code:
Worksheets("Sheet1").Copy After:=Worksheets(Worksheets.Count)
 
Upvote 0
heres my code

here's all four lines of code for my copying..

Code:
Workbooks("omg.xls").Sheets("adfas").Range("a1:da150").Copy
Workbooks("bbq.xls").Worksheets.Add
ActiveSheet.Name = "Day " & r
ActiveSheet.Paste

I don't know the way you're doing it. I'm a real novice at vba, but fairly good at c++ but it's been a while... so it's a little change

thnx for the help
 
Upvote 0
um actually, i have another question... how can i use that code and take the data that i am copying and paste it into another workbook?

i'm trying to use..

Code:
Worksheets("omg.xls").Copy After:=Worksheets(Worksheets.Count)
Workbooks("bbq.xls").Worksheets.Add
Activesheet.name = "Day " & r
activesheet.Paste

but it's pasting the data in the omg.xls and not in the bbq xls like i want to....

any help would be appreciated
 
Upvote 0
Try this.
Code:
Worksheets("omg.xls").Copy After:=Workbooks("bbq.xls").Worksheets(Workbooks("bbq.xls").Worksheets.Count)
 
Upvote 0
got a subscript out of range error.. and i also believe u meant to change omg.xls to my sheet name right?


Worksheets("asdfsa").Copy After:=Workbooks("bbq.xls").Worksheets(Workbooks("bbq.xls").Worksheets.Count)

thnx though
 
Upvote 0
omg!!

nevermind.. lol i'm so sorry it actually did work, my stupid testing earlier renamed one of the sheets so it didn't work initially... but i caught that..

thanks a lot man, you rock! :LOL:
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

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