ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PasteSpecial - Comments and ColorIndex (https://www.excelbanter.com/excel-programming/283044-pastespecial-comments-colorindex.html)

JMay

PasteSpecial - Comments and ColorIndex
 
Can I copy a cell (via Ctl-C) and then click on a destination, whether a
single cell or multiple cells - then activate a macro that will copy the
comments, the border and the color (from the source) to the destination
cell(s) without disturbing the value that is already in the destination
cell(s)?
Thks in advance...



Peter Atherton[_3_]

PasteSpecial - Comments and ColorIndex
 
This should do the trick

Sub CopyFormatComents()
'Assumes that range has been copied
If Application.CutCopyMode = xlCopy Then
Selection.PasteSpecial Paste:=xlPasteComments
Selection.PasteSpecial Paste:=xlFormats
Application.CutCopyMode = False
Else: MsgBox "You must copy a cell First"
End If

End Sub

Regards
Peter
-----Original Message-----
Can I copy a cell (via Ctl-C) and then click on a

destination, whether a
single cell or multiple cells - then activate a macro

that will copy the
comments, the border and the color (from the source) to

the destination
cell(s) without disturbing the value that is already in

the destination
cell(s)?
Thks in advance...


.


JMay

PasteSpecial - Comments and ColorIndex
 
I entered your Sub() but when I run it (after first doing a Copy, the
destination select - a single cell) ----- I get:
"You must copy a cell First" OK
We're almost there...
Thanks,

"Peter Atherton" wrote in message
...
This should do the trick

Sub CopyFormatComents()
'Assumes that range has been copied
If Application.CutCopyMode = xlCopy Then
Selection.PasteSpecial Paste:=xlPasteComments
Selection.PasteSpecial Paste:=xlFormats
Application.CutCopyMode = False
Else: MsgBox "You must copy a cell First"
End If

End Sub

Regards
Peter
-----Original Message-----
Can I copy a cell (via Ctl-C) and then click on a

destination, whether a
single cell or multiple cells - then activate a macro

that will copy the
comments, the border and the color (from the source) to

the destination
cell(s) without disturbing the value that is already in

the destination
cell(s)?
Thks in advance...


.




JMay

PasteSpecial - Comments and ColorIndex
 
Peter, a quick note.... When I do a Step-through (with both windows on
screen) it works; but with my VBE closed, I'm getting the You must copy a
cell First" OK
Tks,
JMay

"JMay" wrote in message
news:6JUub.28083$HD3.27416@lakeread06...
I entered your Sub() but when I run it (after first doing a Copy, the
destination select - a single cell) ----- I get:
"You must copy a cell First" OK
We're almost there...
Thanks,

"Peter Atherton" wrote in message
...
This should do the trick

Sub CopyFormatComents()
'Assumes that range has been copied
If Application.CutCopyMode = xlCopy Then
Selection.PasteSpecial Paste:=xlPasteComments
Selection.PasteSpecial Paste:=xlFormats
Application.CutCopyMode = False
Else: MsgBox "You must copy a cell First"
End If

End Sub

Regards
Peter
-----Original Message-----
Can I copy a cell (via Ctl-C) and then click on a

destination, whether a
single cell or multiple cells - then activate a macro

that will copy the
comments, the border and the color (from the source) to

the destination
cell(s) without disturbing the value that is already in

the destination
cell(s)?
Thks in advance...


.






Peter Atherton[_3_]

PasteSpecial - Comments and ColorIndex
 
I've tried this again and it works OK for me. The message
is only to tell the user that he has not copied anything
to the clipboard before running the macro.

Copy the cell then select the destination cell and then
run the macro

Regards
Peter

-----Original Message-----
I entered your Sub() but when I run it (after first doing

a Copy, the
destination select - a single cell) ----- I get:
"You must copy a cell First" OK
We're almost there...
Thanks,

"Peter Atherton"

wrote in message
...
This should do the trick

Sub CopyFormatComents()
'Assumes that range has been copied
If Application.CutCopyMode = xlCopy Then
Selection.PasteSpecial Paste:=xlPasteComments
Selection.PasteSpecial Paste:=xlFormats
Application.CutCopyMode = False
Else: MsgBox "You must copy a cell First"
End If

End Sub

Regards
Peter
-----Original Message-----
Can I copy a cell (via Ctl-C) and then click on a

destination, whether a
single cell or multiple cells - then activate a macro

that will copy the
comments, the border and the color (from the source) to

the destination
cell(s) without disturbing the value that is already in

the destination
cell(s)?
Thks in advance...


.



.


Debra Dalgleish

PasteSpecial - Comments and ColorIndex
 
When you choose ToolsMacroMacros, CutCopyMode changes to False.
To run the macro, you could add a toolbar button, or assign a keyboard
shortcut.

JMay wrote:
I entered your Sub() but when I run it (after first doing a Copy, the
destination select - a single cell) ----- I get:
"You must copy a cell First" OK
We're almost there...
Thanks,

"Peter Atherton" wrote in message
...

This should do the trick

Sub CopyFormatComents()
'Assumes that range has been copied
If Application.CutCopyMode = xlCopy Then
Selection.PasteSpecial Paste:=xlPasteComments
Selection.PasteSpecial Paste:=xlFormats
Application.CutCopyMode = False
Else: MsgBox "You must copy a cell First"
End If

End Sub

Regards
Peter

-----Original Message-----
Can I copy a cell (via Ctl-C) and then click on a


destination, whether a

single cell or multiple cells - then activate a macro


that will copy the

comments, the border and the color (from the source) to


the destination

cell(s) without disturbing the value that is already in


the destination

cell(s)?
Thks in advance...


.






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


JMay

PasteSpecial - Comments and ColorIndex
 
That was the "prob"- Thanks to you both Peter and Debra
It works fine, now..
Most helpful..
JMay

"Debra Dalgleish" wrote in message
...
When you choose ToolsMacroMacros, CutCopyMode changes to False.
To run the macro, you could add a toolbar button, or assign a keyboard
shortcut.

JMay wrote:
I entered your Sub() but when I run it (after first doing a Copy, the
destination select - a single cell) ----- I get:
"You must copy a cell First" OK
We're almost there...
Thanks,

"Peter Atherton" wrote in message
...

This should do the trick

Sub CopyFormatComents()
'Assumes that range has been copied
If Application.CutCopyMode = xlCopy Then
Selection.PasteSpecial Paste:=xlPasteComments
Selection.PasteSpecial Paste:=xlFormats
Application.CutCopyMode = False
Else: MsgBox "You must copy a cell First"
End If

End Sub

Regards
Peter

-----Original Message-----
Can I copy a cell (via Ctl-C) and then click on a

destination, whether a

single cell or multiple cells - then activate a macro

that will copy the

comments, the border and the color (from the source) to

the destination

cell(s) without disturbing the value that is already in

the destination

cell(s)?
Thks in advance...


.






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html





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

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