View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
David McRitchie[_2_] David McRitchie[_2_] is offline
external usenet poster
 
Posts: 134
Default Simulating the Format Painter, Selection.Select, and taking focus

I've often seen postings relating to Buttons concerning Taking Focus
but now in trying to find out why I need Selection.Select to get
a macro to work. I ran across several postings mentioning
"Taking Focus" while searching the Google groups archives on
"selection.select", so I guess I need a clear understanding
of what this really means.

I created a macro to simulate the Format Painter which can resize
it's output to match the selection of the destination rather than the
dimension of the source. The resizing only occurs by including
selection.select
otherwise you must choose 1 cell, or a matching dimension for the
destination. More complete description and examples in
http://www.mvps.org/dmcritchie/excel/paste.htm#painter

Sub PasteSpecialFormats()
'David McRitchie, paste.htm, programming, 2003-07-08
Selection.Select 'makes it work like the Format Painter
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub

Can someone tell me what taking focus means here. Without the
selection.select what has the focus.
---
HTH, (using Excel 2000 and the OS is Windows 2000)
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm