Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Macro to select the Format Painter?

20 views
Skip to first unread message

Terry Pinnell

unread,
Jul 30, 2021, 12:55:04 PM7/30/21
to
(Mistakenly posted earlier in microsoft.public.excel.misc)

I use the Format Painter a lot and often it would be a bit faster
to activate it with the keyboard instead of clicking the tool
icon. I don't believe there is one built into Excel 365 so I tried
the trivial macro below. However, that and various other versions
I tried all fail.

How do I simply get it to simply click the Format Painter and copy
the active cell please, ready for pasting that format elsewhere?

'
Sub ClickFormatPainter()
'
' Select cell to copy then activate Format Painter, ready to paste
elsewhere.
' Keyboard Shortcut: Ctrl+Shift+F
'
ActiveCell.Address.Select
Selection.Copy
End Sub

P.S: I have meanwhile implemented a suggestion made elsewhere, to move
the Format Painter to the left hand side of the QAT, and use Alt+1. But
I'd stll like to know if a macro can do it please?


Terry

Claus Busch

unread,
Jul 30, 2021, 1:21:07 PM7/30/21
to
Hi Terry,

Am Fri, 30 Jul 2021 17:54:57 +0100 schrieb Terry Pinnell:

> (Mistakenly posted earlier in microsoft.public.excel.misc)
>
> I use the Format Painter a lot and often it would be a bit faster
> to activate it with the keyboard instead of clicking the tool
> icon. I don't believe there is one built into Excel 365 so I tried
> the trivial macro below. However, that and various other versions
> I tried all fail.
>
> How do I simply get it to simply click the Format Painter and copy
> the active cell please, ready for pasting that format elsewhere?

why don't you paste the formats with VBA directly?

Sub CpyFormat()
Range("A1").Copy
Selection.PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End Sub


Regards
Claus B.
--
Windows10
Microsoft 365 for business

Terry Pinnell

unread,
Aug 1, 2021, 1:24:36 PM8/1/21
to
Thanks, good to hear from you Claus.

I don't follow your suggestion, which pastes the format of a fixed cell,
A1.

I want the macro to copy the format of whatever cell is currently
selected. I can then select the target (e.g. by clicking it, or moving
to it) and the copied format will be immediately applied to it.

That's what happens when I use <Alt+1>.

Best wishes,

Terry

====================

Adrian Caspersz

unread,
Aug 8, 2021, 5:25:18 PM8/8/21
to
On 30/07/2021 17:54, Terry Pinnell wrote:
> (Mistakenly posted earlier in microsoft.public.excel.misc)
>
> I use the Format Painter a lot and often it would be a bit faster
> to activate it with the keyboard instead of clicking the tool
> icon.

https://www.infopathdev.com/blogs/greg/archive/2005/06/27/Lock-the-Format-Painter-for-Repeated-Usage.aspx


--
Adrian C
0 new messages