ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format Paste from nonmerged cell to merged cell (https://www.excelbanter.com/excel-programming/420516-format-paste-nonmerged-cell-merged-cell.html)

Annette[_3_]

Format Paste from nonmerged cell to merged cell
 
Is there a method to paste from a nonmerged cell to a merged cell the color
of the originator? I am able to use this macro to copy the number, but I
need the originating color from time to time and wondered if it that could
be included in the macro.

Sub CopyProductCells
ActiveCell.Select
Selection.Copy
ActiveSheet.Previous.Select

ActiveCell.Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

End Sub

Annette



royUK[_61_]

Format Paste from nonmerged cell to merged cell
 

Most people would recommend that you avoid using Merged Cells


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33823


Peter T

Format Paste from nonmerged cell to merged cell
 
You could store the .Interior.ColorIndex property of the merged area to a
variable and apply same to the destination range. You could do that in
tandem with your paste special.

Regards,
Peter T


"Annette" wrote in message
...
Is there a method to paste from a nonmerged cell to a merged cell the
color of the originator? I am able to use this macro to copy the number,
but I need the originating color from time to time and wondered if it that
could be included in the macro.

Sub CopyProductCells
ActiveCell.Select
Selection.Copy
ActiveSheet.Previous.Select

ActiveCell.Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False

End Sub

Annette




Annette[_3_]

Format Paste from nonmerged cell to merged cell
 
Peter, can you tell me how I would do this?

Thanks!

"Peter T" <peter_t@discussions wrote in message
...
You could store the .Interior.ColorIndex property of the merged area to a
variable and apply same to the destination range. You could do that in
tandem with your paste special.

Regards,
Peter T


"Annette" wrote in message
...
Is there a method to paste from a nonmerged cell to a merged cell the
color of the originator? I am able to use this macro to copy the number,
but I need the originating color from time to time and wondered if it
that could be included in the macro.

Sub CopyProductCells
ActiveCell.Select
Selection.Copy
ActiveSheet.Previous.Select

ActiveCell.Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False

End Sub

Annette






Peter T

Format Paste from nonmerged cell to merged cell
 
The following is based as best I can on what you posted earlier. Not sure
it'll work as required but see how you get on.

Generally it's not usually necessary to select something, though with your
'ActiveSheet.Previous.Select' in this case looks as if it is.

Sub test()
Dim clrIdx As Long
Dim rngSource As Range
Dim rngDest As Range

Set rngSource = Selection
rngSource.Copy
clrIdx = rngSource(1).Interior.ColorIndex

ActiveSheet.Previous.Select
Set rngDest = Selection

rngDest.PasteSpecial Paste:=xlFormulas
rngDest.Interior.ColorIndex = clrIdx

End Sub

Regards,
Peter T

"Annette" wrote in message
...
Peter, can you tell me how I would do this?

Thanks!

"Peter T" <peter_t@discussions wrote in message
...
You could store the .Interior.ColorIndex property of the merged area to a
variable and apply same to the destination range. You could do that in
tandem with your paste special.

Regards,
Peter T


"Annette" wrote in message
...
Is there a method to paste from a nonmerged cell to a merged cell the
color of the originator? I am able to use this macro to copy the
number, but I need the originating color from time to time and wondered
if it that could be included in the macro.

Sub CopyProductCells
ActiveCell.Select
Selection.Copy
ActiveSheet.Previous.Select

ActiveCell.Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False

End Sub

Annette









All times are GMT +1. The time now is 10:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com