#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Defined names

I have named in excel 70 cells - I have named them LAST1, LAST2,..., LAST70.
They are in the same column, one underneath the other.
I want to use the following bit of code:

ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LAST1)"

on the right hand side of each cell (as where these "LAST" cells will change
on diffferent worksheets).
Instead of me typing this formula out 70 times, is there a way of defining
the names? I've tried the following way:

Dim i
For i = 1 To 70
ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LASTi)"
ActiveCell.Offset(1, 0).Select
for next i

This will allow me to enter the formula in each cell right hand side of the
Named ones - but VBA doesn't like how I've definied this variable "i" in the
formula. I've tried &i, putting it in "", putting spaces, but I either get
errors in VBA or NAME? in the cell

Any help?

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,646
Default Defined names

I couldn't figure out what do you want to do (eg. what is "IS" in Sumif
formula, where LAST without a number is defined), but

ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LASTi)"


should be written in this way:

ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LAST" & i & ")"

Regards,
Stefi


€˛lesley1000 via OfficeKB.com€¯ ezt Ć*rta:

I have named in excel 70 cells - I have named them LAST1, LAST2,..., LAST70.
They are in the same column, one underneath the other.
I want to use the following bit of code:

ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LAST1)"

on the right hand side of each cell (as where these "LAST" cells will change
on diffferent worksheets).
Instead of me typing this formula out 70 times, is there a way of defining
the names? I've tried the following way:

Dim i
For i = 1 To 70
ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LASTi)"
ActiveCell.Offset(1, 0).Select
for next i

This will allow me to enter the formula in each cell right hand side of the
Named ones - but VBA doesn't like how I've definied this variable "i" in the
formula. I've tried &i, putting it in "", putting spaces, but I either get
errors in VBA or NAME? in the cell

Any help?

--
Message posted via http://www.officekb.com


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Defined names

Fantastic, thank you for that - I knew that there was a way!

Stefi wrote:
I couldn't figure out what do you want to do (eg. what is "IS" in Sumif
formula, where LAST without a number is defined), but

ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LASTi)"


should be written in this way:

ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LAST" & i & ")"

Regards,
Stefi

€˛lesley1000 via OfficeKB.com€¯ ezt Ć*rta:

I have named in excel 70 cells - I have named them LAST1, LAST2,..., LAST70.
They are in the same column, one underneath the other.

[quoted text clipped - 19 lines]

Any help?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200712/1

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,646
Default Defined names

You are welcome! Thanks for the feedback!
Stefi

€˛lesley1000 via OfficeKB.com€¯ ezt Ć*rta:

Fantastic, thank you for that - I knew that there was a way!

Stefi wrote:
I couldn't figure out what do you want to do (eg. what is "IS" in Sumif
formula, where LAST without a number is defined), but

ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LASTi)"


should be written in this way:

ActiveCell.formula = "=SUMIF(D7:LAST,""IS"",D8:LAST" & i & ")"

Regards,
Stefi

€˛lesley1000 via OfficeKB.com€¯ ezt Ć*rta:

I have named in excel 70 cells - I have named them LAST1, LAST2,..., LAST70.
They are in the same column, one underneath the other.

[quoted text clipped - 19 lines]

Any help?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200712/1


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
How to keep names defined after a copy? Warda Excel Discussion (Misc queries) 0 December 5th 06 03:08 PM
NAMES DEFINED F. Lawrence Kulchar Excel Discussion (Misc queries) 5 November 14th 06 07:54 AM
List of defined names coa01gsb Excel Worksheet Functions 4 March 21st 06 04:53 PM
Defined names DREED Excel Discussion (Misc queries) 3 March 10th 06 02:55 PM
Using non defined names from another sheet pQp Excel Worksheet Functions 6 July 17th 05 11:06 PM


All times are GMT +1. The time now is 10:42 AM.

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"