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

Hello,

I am pasting data with a macro using
xlPasteValuesAndNumberFormats. In computers that have
excel 2000, this constant is not recognized. I looked it
up in the "object examinator"(F2), and it is part of the
class XlPasteType. However, in excel 2000 this class
doesn't have the xlPasteValuesAndNumberFormats constant.
Is there a way to add this constant without having to
install a newer version of excel?

Thanks for your help
Fernando E
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default xlPasteValuesAndNumberFormats

range("A1").Pastespecial xlvalues
range("A1").Pastespecial xlFormats

--
Regards,
Tom Ogilvy

"fernando" wrote in message
...
Hello,

I am pasting data with a macro using
xlPasteValuesAndNumberFormats. In computers that have
excel 2000, this constant is not recognized. I looked it
up in the "object examinator"(F2), and it is part of the
class XlPasteType. However, in excel 2000 this class
doesn't have the xlPasteValuesAndNumberFormats constant.
Is there a way to add this constant without having to
install a newer version of excel?

Thanks for your help
Fernando E



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default xlPasteValuesAndNumberFormats

Hi Fernando,

This paste special option was first introduced in Excel 2002, so it will
not work in Excel 2000. There really isn't any completely equivalent way to
do this operation in Excel 2000 either. The closest would be to perform to
paste special operations in a row, as shown below, one to paste values and
the other to paste formats. This will work in all versions of Excel, but it
will paste all formats, not just number formats.

Sheet1.Range("A1").Copy
Sheet1.Range("A2").PasteSpecial Paste:=xlValues
Sheet1.Range("A2").PasteSpecial Paste:=xlFormats

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"fernando" wrote in message
...
Hello,

I am pasting data with a macro using
xlPasteValuesAndNumberFormats. In computers that have
excel 2000, this constant is not recognized. I looked it
up in the "object examinator"(F2), and it is part of the
class XlPasteType. However, in excel 2000 this class
doesn't have the xlPasteValuesAndNumberFormats constant.
Is there a way to add this constant without having to
install a newer version of excel?

Thanks for your help
Fernando E



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default xlPasteValuesAndNumberFormats

or

Sub Tester1()
Dim srcrng As Range, cell As Range
Set srcrng = Range("F3:G22")
srcrng.Copy
Range("A1").PasteSpecial xlValues
For Each cell In srcrng
Range("A1").Offset( _
cell.Row - srcrng(1).Row, _
cell.Column - srcrng(1).Column) _
.NumberFormat = cell.NumberFormat
Next
End Sub


"fernando" wrote in message
...
Hello,

I am pasting data with a macro using
xlPasteValuesAndNumberFormats. In computers that have
excel 2000, this constant is not recognized. I looked it
up in the "object examinator"(F2), and it is part of the
class XlPasteType. However, in excel 2000 this class
doesn't have the xlPasteValuesAndNumberFormats constant.
Is there a way to add this constant without having to
install a newer version of excel?

Thanks for your help
Fernando E



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



All times are GMT +1. The time now is 03:46 PM.

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

About Us

"It's about Microsoft Excel"