Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Apply a macro to a pre-selected range of cells
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Apply a macro to a pre-selected range of cells
Did you try something like:
Sub x() Dim Rg As Range Set Rg = Selection 'your code here Set Rg = Nothing End Su -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
modify a macro to apply to a specific range of cells | Excel Discussion (Misc queries) | |||
How do i a apply range(autoformat) in non-adjacent cells? | New Users to Excel | |||
How to apply rounding across a range of cells with other formulae | Excel Worksheet Functions | |||
How can I apply the ROUND function to a range of cells in a workbo | Excel Discussion (Misc queries) | |||
How to apply a function across a range of cells | Excel Programming |