Re: MSForms.DataObject Misbehaving
- From: Chip Pearson <chip@xxxxxxxxxxxx>
- Date: Sun, 28 Dec 2008 07:53:23 -0600
The DataObject's clipboard functions are limited to storing text
strings. Here's one way to swap the contents and formatting of two
cells, A1 and B1 in this case:
Dim R1 As Range
Dim R2 As Range
Dim Temp As Range
Dim WS As Worksheet
Set WS = ActiveSheet
Set R1 = Range("A1")
Set R2 = Range("B1")
With WS.UsedRange
Set Temp = .Item(.Cells.Count)(2, 1)
End With
R1.Copy Destination:=Temp
R2.Copy Destination:=R1
Temp.Copy Destination:=R2
Temp.Clear
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Sat, 27 Dec 2008 10:09:09 -0800 (PST), atpgroups
<bodgesoc@xxxxxxxxx> wrote:
On 27 Dec, 17:33, JLGWhiz <JLGW...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:.
Excel default is to use the formatting of the receiving range. To do what I
think you want to do, you would need to use a two step process. Step 1.
Range(x).Copy then Range(y).PasteSpecial Paste:=xlPasteFormats. Step 2.
Range(y).PasteSpecial Paste:=xlPasteValues
The copy and pasting isn't the real issue, the problem is how to
_swap_ the values and formats. ie How can I store the formats in range
X when pasting Range Y into it.
- References:
- MSForms.DataObject Misbehaving
- From: atpgroups
- RE: MSForms.DataObject Misbehaving
- From: JLGWhiz
- Re: MSForms.DataObject Misbehaving
- From: atpgroups
- MSForms.DataObject Misbehaving
- Prev by Date: Re: Search for Values
- Next by Date: hide and unhde worksheets when a set button on a form is clicked
- Previous by thread: Re: MSForms.DataObject Misbehaving
- Next by thread: Access form from Excel
- Index(es):
Relevant Pages
|