Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Set Range Using Selected Cells
I have a macro that I want to execute on the cells that I have selected on a
worksheet, that is, where 'Set myRng = Activesheet.Range(first selected cell: last selected cell) or something like that. Any suggestions? Thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Set Range Using Selected Cells
this may do what you want if you have a contiguous range of cells selected
Dim rng As Range Set rng = Range(Selection.Address) -- Gary "Paputxi" wrote in message ... I have a macro that I want to execute on the cells that I have selected on a worksheet, that is, where 'Set myRng = Activesheet.Range(first selected cell: last selected cell) or something like that. Any suggestions? Thanks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Set Range Using Selected Cells
have you tried...
Set myRng = Selection -- HTH... Jim Thomlinson "Paputxi" wrote: I have a macro that I want to execute on the cells that I have selected on a worksheet, that is, where 'Set myRng = Activesheet.Range(first selected cell: last selected cell) or something like that. Any suggestions? Thanks in advance |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Set Range Using Selected Cells
Here is a typical format:
Sub Macro1() Dim r As Range For Each r In Selection r.Interior.ColorIndex = 6 Next End Sub You select the cells on the sheet and the macro "does something" to them. -- Gary's Student "Paputxi" wrote: I have a macro that I want to execute on the cells that I have selected on a worksheet, that is, where 'Set myRng = Activesheet.Range(first selected cell: last selected cell) or something like that. Any suggestions? Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
range of cells selected when I click on one | Excel Discussion (Misc queries) | |||
Put data in range of selected cells | Excel Discussion (Misc queries) | |||
Average Selected Cells From a Range | Excel Worksheet Functions | |||
Compare a selected Range with a Named range and select cells that do not exist | Excel Programming | |||
max/min of a selected range of cells | Excel Programming |