Set a shortcut key for "Copy Format"

smallxyz

Active Member
Joined
Jul 27, 2015
Messages
393
Office Version
  1. 2021
Platform
  1. Windows
Hi,

Is there a way to set a shortcut key for "Copy Format" ?
Or use VBA to imitate the usual mouse-click / mouse-double-click function of "Copy Format"


Thanks a lot!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Re: [VBA] Set a shortcut key for "Copy Format"

Hi,

You can record your own macro ... and give it the shortcut you want ...
 
Upvote 0
Re: [VBA] Set a shortcut key for "Copy Format"

Hi James,
But the macro cannot imitate the mouse-double-click function (continual paste of format ) of "Copy Format"
 
Upvote 0
Re: [VBA] Set a shortcut key for "Copy Format"

Hi,

Sorry ... do not understand you remark ...

If you need to repeat a Copy Format you have just made ... you can use the function key F4
 
Upvote 0
Re: [VBA] Set a shortcut key for "Copy Format"

Cross posted https://chandoo.org/forum/threads/vba-set-a-shortcut-key-for-copy-format.42859/

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Re: [VBA] Set a shortcut key for "Copy Format"

Do you want copy or paste format?

Ctrl + Alt + v, t, enter
 
Upvote 0
Re: [VBA] Set a shortcut key for "Copy Format"

What do you call :

the usual mouse-click / mouse-double-click function of "Copy Format"
 
Upvote 0
Re: [VBA] Set a shortcut key for "Copy Format"

Problem solved. Thanks all. I use the following VBA code.

Code:
Private [I]Sub[/I] Workbook_Open[I]([/I][I])[/I]
    On Error Resume Next
    Application.ScreenUpdating = False
    Dim SC_Dict As [I]Object[/I]
    
    ' ________________ [ OnKey ] ________________
    '   Ctrl  Shift  Alt
    '   ^    +    %
    
    Set SC_Dict = Create[I]Object[/I][I]([/I]"Scripting.Dictionary"[I])[/I]
    With SC_Dict
        
        .Add "^+[I]{[/I]v[I]}[/I]"[I],[/I] "PasteFormats"
        
        For Each k In .Keys
            Application.OnKey k[I],[/I] Me.CodeName & "." & SC_Dict[I]([/I]k[I])[/I]
        Next
        '---------------------
    End With
[I]End Sub[/I]



[I]Sub[/I] PasteFormats[I]([/I][I])[/I]
    On Error Resume Next
    Selection.PasteSpecial Paste:=xlPasteFormats[I],[/I] Operation:=xlNone[I],[/I] SkipBlanks:=False[I],[/I] Transpose:=False
    On Error GoTo 0
[I]End Sub[/I]
 
Last edited:
Upvote 0
Re: [VBA] Set a shortcut key for "Copy Format"

usual mouse-click function of "Copy Format" : only paste format once
mouse-double-click function of "Copy Format" : paste format many times upon user's clicks
 
Upvote 0
Re: [VBA] Set a shortcut key for "Copy Format"

What do you call :

the usual mouse-click / mouse-double-click function of "Copy Format"
usual mouse-click function of "Copy Format" : only paste format once
mouse-double-click function of "Copy Format" : paste format many times upon user's clicks
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,961
Members
452,539
Latest member
delvey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top