Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default PasteSpecial question

I am using office 2003
I recorded a macro to open my master wb, copy an entire sheet and
pastespecial to a blank sheet inserted in another workbook.
The problem is when I run the macro I get a dialog box giving me the
choice of pasting unicode text or just text. I chose Unicode Text - but
that did not paste my formatting or my formulas.

Here is the macro:
Sub GetMstrInfo()
Workbooks.Open Filename:="C:\Pricing\TestJoes\TestMaster.xls"
Sheets("Tr-Vul").Select
Range("A1:K32").Select
Range("A2").Activate
Selection.Copy
ActiveWindow.Close
Sheets.Add
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False
End Sub

Could someone please tell me how to adapt this macro so that my new
worksheet has all the formulas and the formatting as the worksheet I am
copying from? I see PasteSpecial Format:="Unicode Text", but I don't
know how to change that statement to get what i need.

TIA
Joanne
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default PasteSpecial question

maybe something like this:

Sub GetMstrInfo()
Dim wb1 As Workbook
Dim wb2 As Workbook
Set wb1 = ActiveWorkbook
Workbooks.Open Filename:="C:\Pricing\TestJoes\TestMaster.xls"
Set wb2 = ActiveWorkbook
With wb2.Sheets("Tr-Vul")
.Range("A1:K32").Copy
End With
With wb1
.Sheets.Add
.Worksheets(Worksheets.Count).Paste
End With
Application.CutCopyMode = False
wb2.Close savechanges:=False
End Sub

--


Gary


"Joanne" wrote in message
...
I am using office 2003
I recorded a macro to open my master wb, copy an entire sheet and
pastespecial to a blank sheet inserted in another workbook.
The problem is when I run the macro I get a dialog box giving me the
choice of pasting unicode text or just text. I chose Unicode Text - but
that did not paste my formatting or my formulas.

Here is the macro:
Sub GetMstrInfo()
Workbooks.Open Filename:="C:\Pricing\TestJoes\TestMaster.xls"
Sheets("Tr-Vul").Select
Range("A1:K32").Select
Range("A2").Activate
Selection.Copy
ActiveWindow.Close
Sheets.Add
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False
End Sub

Could someone please tell me how to adapt this macro so that my new
worksheet has all the formulas and the formatting as the worksheet I am
copying from? I see PasteSpecial Format:="Unicode Text", but I don't
know how to change that statement to get what i need.

TIA
Joanne



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default PasteSpecial question


"Joanne" wrote in message
...
I am using office 2003
I recorded a macro to open my master wb, copy an entire sheet and
pastespecial to a blank sheet inserted in another workbook.
The problem is when I run the macro I get a dialog box giving me the
choice of pasting unicode text or just text. I chose Unicode Text - but
that did not paste my formatting or my formulas.

Here is the macro:
Sub GetMstrInfo()
Workbooks.Open Filename:="C:\Pricing\TestJoes\TestMaster.xls"
Sheets("Tr-Vul").Select
Range("A1:K32").Select
Range("A2").Activate
Selection.Copy
ActiveWindow.Close
Sheets.Add
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False
End Sub

Could someone please tell me how to adapt this macro so that my new
worksheet has all the formulas and the formatting as the worksheet I am
copying from? I see PasteSpecial Format:="Unicode Text", but I don't
know how to change that statement to get what i need.

TIA
Joanne


Joanne,

Since it appears that you want to paste everything instead of just the text
or just the values, try replacing the line:

ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False


with:

ActiveSheet.Paste

or:

ActiveSheet.PasteSpecial Paste:=xlPasteAll

And see if that gives you the results you desire...

David


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default PasteSpecial question

If you want formulas and formatting, then you probably just want to copy and
paste, not pastespecial:

Sub GetMstrInfo()
Dim sh as Worksheet
Dim bk as Workbook
sheets.add
set sh = Activesheet
set bk= Workbooks.Open( Filename:="C:\Pricing\TestJoes\TestMaster.xls")
bk.Sheets("Tr-Vul").Range("A1:K32").copy sh.Range("A1")
bk.close SaveChanges:=False
End Sub

--
Regards,
Tom Ogilvy


"Joanne" wrote:

I am using office 2003
I recorded a macro to open my master wb, copy an entire sheet and
pastespecial to a blank sheet inserted in another workbook.
The problem is when I run the macro I get a dialog box giving me the
choice of pasting unicode text or just text. I chose Unicode Text - but
that did not paste my formatting or my formulas.

Here is the macro:
Sub GetMstrInfo()
Workbooks.Open Filename:="C:\Pricing\TestJoes\TestMaster.xls"
Sheets("Tr-Vul").Select
Range("A1:K32").Select
Range("A2").Activate
Selection.Copy
ActiveWindow.Close
Sheets.Add
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False
End Sub

Could someone please tell me how to adapt this macro so that my new
worksheet has all the formulas and the formatting as the worksheet I am
copying from? I see PasteSpecial Format:="Unicode Text", but I don't
know how to change that statement to get what i need.

TIA
Joanne

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default PasteSpecial question

Hi Joanne,

If you want to copy a worksheet with all formats etc, then try the Worksheet
copy. Record a macro to do it and you will get the code. You do it this way:-

Open the workbook into which you want to copy the worksheet.

Change windows to the worksheet to be copied.

Right click on the worksheet tab name-Move or Copy-Select the To workbook-
Check box to Create copy- Ok.

The copied worksheet becomes the active sheet. If it is a unique name in the
new workbook then it keeps the same name it had in the original workbook
otherwise it will have (2) after the name. If required, in the macro use
ActiveSheet.Name = "Whatever" if you want to rename it.

Regards,

OssieMac


"Joanne" wrote:

I am using office 2003
I recorded a macro to open my master wb, copy an entire sheet and
pastespecial to a blank sheet inserted in another workbook.
The problem is when I run the macro I get a dialog box giving me the
choice of pasting unicode text or just text. I chose Unicode Text - but
that did not paste my formatting or my formulas.

Here is the macro:
Sub GetMstrInfo()
Workbooks.Open Filename:="C:\Pricing\TestJoes\TestMaster.xls"
Sheets("Tr-Vul").Select
Range("A1:K32").Select
Range("A2").Activate
Selection.Copy
ActiveWindow.Close
Sheets.Add
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False
End Sub

Could someone please tell me how to adapt this macro so that my new
worksheet has all the formulas and the formatting as the worksheet I am
copying from? I see PasteSpecial Format:="Unicode Text", but I don't
know how to change that statement to get what i need.

TIA
Joanne



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default PasteSpecial question

Thanks for your help everyone.
Joanne wrote:

I am using office 2003
I recorded a macro to open my master wb, copy an entire sheet and
pastespecial to a blank sheet inserted in another workbook.
The problem is when I run the macro I get a dialog box giving me the
choice of pasting unicode text or just text. I chose Unicode Text - but
that did not paste my formatting or my formulas.

Here is the macro:
Sub GetMstrInfo()
Workbooks.Open Filename:="C:\Pricing\TestJoes\TestMaster.xls"
Sheets("Tr-Vul").Select
Range("A1:K32").Select
Range("A2").Activate
Selection.Copy
ActiveWindow.Close
Sheets.Add
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False
End Sub

Could someone please tell me how to adapt this macro so that my new
worksheet has all the formulas and the formatting as the worksheet I am
copying from? I see PasteSpecial Format:="Unicode Text", but I don't
know how to change that statement to get what i need.

TIA
Joanne


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why need to use Selection.PasteSpecial vs myRange.PasteSpecial [email protected] Excel Programming 4 June 25th 07 05:34 PM
Quick Question - PasteSpecial mr tom Excel Programming 5 February 14th 07 03:30 AM
pastespecial question Gary Keramidas Excel Programming 6 October 11th 05 12:31 AM
pastespecial question Paul Excel Programming 5 May 19th 05 01:07 PM
pastespecial on a worksheet question mike Excel Programming 1 February 11th 04 08:03 PM


All times are GMT +1. The time now is 12:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"