Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to run relative to current selected cell
I need a macro to run relative to the current selected cell so that, if I
click the macro button the (eg.) whole current row will be selected along with the four below, etc. - and not the the specific row from which I started recording the macro. Can anyone suggest a way? Is there a code that refers to the current position? Many thanks, Mary |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to run relative to current selected cell
Sub selectrngfromactivecell()
ActiveCell.Resize(4, 1).EntireRow.Select End Sub or Sub srfac() Rows(ActiveCell.Row).Resize(4).Select End Sub -- Don Guillett SalesAid Software "MahD" wrote in message ... I need a macro to run relative to the current selected cell so that, if I click the macro button the (eg.) whole current row will be selected along with the four below, etc. - and not the the specific row from which I started recording the macro. Can anyone suggest a way? Is there a code that refers to the current position? Many thanks, Mary |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to run relative to current selected cell
One way:
Option Explicit Sub testme() ActiveCell.Resize(5, 1).EntireRow.Select 'do you want to go to column A of that first row? 'ActiveCell.EntireRow.Cells(1).Activate End Sub MahD wrote: I need a macro to run relative to the current selected cell so that, if I click the macro button the (eg.) whole current row will be selected along with the four below, etc. - and not the the specific row from which I started recording the macro. Can anyone suggest a way? Is there a code that refers to the current position? Many thanks, Mary -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to run relative to current selected cell
Simply using your arrow keys to navigate and pressing ctrl-c while recording
will select a relative range provided the relative reference button is selected. On executing the macro it will select the range relative to where your cursor is at that time. I have not, however, found a way to take it a step further and name such a range relatively. "MahD" wrote: I need a macro to run relative to the current selected cell so that, if I click the macro button the (eg.) whole current row will be selected along with the four below, etc. - and not the the specific row from which I started recording the macro. Can anyone suggest a way? Is there a code that refers to the current position? Many thanks, Mary |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert date | Excel Worksheet Functions | |||
Running a Macro when a single cell is selected | Excel Discussion (Misc queries) | |||
How do i make a macro "relative" to cell? | Excel Discussion (Misc queries) | |||
Copy cell format to cell on another worksht and update automatical | Excel Worksheet Functions | |||
Relative Macro Help on Keystrokes | Excel Discussion (Misc queries) |