Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 148
Default I need a macro

I would like a macro to do the following:
I would place the the cursor in any cell and this macro would give me the
average of all the entries to the left if the selected cell. EX: I place the
cursor in cell M12.
I want this macro on display in cell M12 the average of all the values from
Col C12 to Col L12. Note that there may NOT be entries in all the cells in
that range. Also the start point would always be col C .Thanks
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default I need a macro

You can do this easily with a worksheet_selection event in the sheet module
but you would probably want to restrict to a certain range or columns and
rows or it would fire EACH time you select ANY cell. Never less than col C
and never more than column _____? rows________?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"pcor" wrote in message
...
I would like a macro to do the following:
I would place the the cursor in any cell and this macro would give me the
average of all the entries to the left if the selected cell. EX: I place
the
cursor in cell M12.
I want this macro on display in cell M12 the average of all the values
from
Col C12 to Col L12. Note that there may NOT be entries in all the cells in
that range. Also the start point would always be col C .Thanks


  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 148
Default I need a macro

Thanks for thr quick reply....BUT can you please tell me HOW to accomplish
that!
Thanks

"Don Guillett" wrote:

You can do this easily with a worksheet_selection event in the sheet module
but you would probably want to restrict to a certain range or columns and
rows or it would fire EACH time you select ANY cell. Never less than col C
and never more than column _____? rows________?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"pcor" wrote in message
...
I would like a macro to do the following:
I would place the the cursor in any cell and this macro would give me the
average of all the entries to the left if the selected cell. EX: I place
the
cursor in cell M12.
I want this macro on display in cell M12 the average of all the values
from
Col C12 to Col L12. Note that there may NOT be entries in all the cells in
that range. Also the start point would always be col C .Thanks



  #6   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default I need a macro

Right click sheet tabview codeinsert thisadjust columns/rowsSAVE
workbook.
Now if you select a cell within the allowed area you will get your average.
Please note that you will have difficulty putting info into the cells so you
may want to comment out the macro to do that.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row <12 Or Target.Row 25 _
Or Target.Column < 3 Or Target.Column 14 Then Exit Sub
tr = Target.Row
tc = Target.Column - 1
MsgBox Application.Average(Range(Cells(tr, 3), Cells(tr, tc)))
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"pcor" wrote in message
...
I would like a macro to do the following:
I would place the the cursor in any cell and this macro would give me the
average of all the entries to the left if the selected cell. EX: I place
the
cursor in cell M12.
I want this macro on display in cell M12 the average of all the values
from
Col C12 to Col L12. Note that there may NOT be entries in all the cells in
that range. Also the start point would always be col C .Thanks


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
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 02:30 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"