PC Review


Reply
Thread Tools Rate Thread

Copy Range to a New WorkBook + Name Sheet a cell Value + Name WorkBook another Celll Value

 
 
Corey
Guest
Posts: n/a
 
      2nd Nov 2006
I have a spreadsheet that has many formulas in it.
I want to COPY the format(Cell Shading + Font Size/Colour + Column & Row
Dimensions) and the Cell Values from a specific Sheet Range of "A1:U41",
and
Place this copied range into a NEW WorkBook, bringing all the above
mentioned formats with it.

Then name that worksheet cell value "K2",
then

Name and save the New WorkBook the cell value "E2".

I have tried a Macro Recorder, and all started well but the paste step that
recorded comes up with an error.
The error was at the line below with arrow:


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub SaveTS()

Sheets("F Flintstone").Select
Range("A1:U41").Select
Selection.Copy
Workbooks.Add
Range("A1").Select
ActiveSheet.Paste ' <==================================== ERROR
Application.CommandBars("Task Pane").Visible = False
Range("A:A,D,G:G,J:J,M:M,P:P,S:S").Select ' <==== Formats the Column
widths as the copied sheet
Range("K2").Activate
Selection.ColumnWidth = 1
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "F Flintstone" ' <======== Names the New
WorkBook Sheet the Cell Value
Range("A1").Select ' <===================== Need to add WorkBook Naming
from Cell Value "E2" here Also
End Sub

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any idea's why, and how to get around?

Regards

CTM


 
Reply With Quote
 
 
 
 
Corey
Guest
Posts: n/a
 
      2nd Nov 2006
OK,
Got the date in a new wkbook now from code below:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub Save2()
With ActiveWorkbook.Sheets("F Flintstone")
.Select
.Range("a1:u41").Copy
Workbooks.Add
Application.CommandBars("Task Pane").Visible = False
Range("A:A,D,G:G,J:J,M:M,P:P,S:S").Select
Selection.ColumnWidth = 1
Sheets("Sheet1").Range("A1:U42").PasteSpecial Paste:=xlPasteValues
Sheets("Sheet1").Range("A1:U42").PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End With

End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Now for the Naming of the sheet


 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      2nd Nov 2006
Ok,
Need to name the WorkBook Todays Date now.

I have a date format cell i am trying to call the workbook, but because it
contains "/"'s i get an error(Although i have formatted the cell to view 31
October 2006).
How can i get the date in the cell to remove the "/"'s? OR Use the Cell View
Format instead.
Thus avoiding the error.


--
Regards

CTM


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Sheet In Same Workbook But Do Not Know how to Change Cell Ref =?Utf-8?B?S2V2aW4gTA==?= Microsoft Excel Programming 0 31st Jul 2007 03:00 PM
Hyperlinks to '[workbook]Sheet!'Range(Cell) Snoopy Microsoft Excel Discussion 2 21st Mar 2007 11:06 AM
copy a sheet not all the range names in a workbook JulieD Microsoft Excel Misc 2 12th Oct 2004 12:45 AM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Microsoft Excel Programming 3 24th Jun 2004 12:50 PM
Cell range copy to second workbook GerryK Microsoft Excel Worksheet Functions 2 25th Mar 2004 05:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:20 AM.