ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   I need a macro (https://www.excelbanter.com/new-users-excel/181927-i-need-macro.html)

pcor

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

Don Guillett

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



pcor

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




Don Guillett

I need a macro
 

Let's see, you didn't answer my questions, did you?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"pcor" wrote in message
...
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





pcor

I need a macro
 
it could be asked for from any col past M but always starting at col C
thanks

"Don Guillett" wrote:


Let's see, you didn't answer my questions, did you?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"pcor" wrote in message
...
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





Don Guillett

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




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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com