View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Apply a macro to a pre-selected range of cells

Tim,

Try something like

Selection.NumberFormat = "0%"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"tim knowles" wrote in message
...
I wish to create a macro and assign it to a button such
that it formats the range of cells that has been selected
immediately prior to clicking the button (in the same way
that the "," or "%" format buttons work. But each time I
record the macro, it refers to the cell that is
highlighted as Range.Select."A5" or Range.Select."C1:J14"
etc.

How can I just refer to which-ever range has been selected?

thanks