Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 89
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert date Larry Excel Worksheet Functions 28 July 15th 06 02:41 AM
Running a Macro when a single cell is selected Jerry Wustrack Excel Discussion (Misc queries) 3 January 31st 06 08:27 PM
How do i make a macro "relative" to cell? Art Nittskoff Excel Discussion (Misc queries) 4 June 22nd 05 07:05 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
Relative Macro Help on Keystrokes Neal Zimm Excel Discussion (Misc queries) 9 December 15th 04 12:31 AM


All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"