Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
RC RC is offline
external usenet poster
 
Posts: 39
Default MAX value in column to use with text for title

I would like to find the maximum and minimum values (integers) in a column of
dynamic size. Then I will plug these values into the title of a chart, i.e.
"WW17-26 Failure Pareto..."

I can identify the dynamic range but can't get MAX() or LARGE() instructions
to assign the largest value to a variable that I can use in the chart title
in vba. I can find a solution by using =MAX("DynamicRange") inside a cell,
but not sure how to get this into the title of a chart that is created
through vba.

Thanks for any help,
rc

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default MAX value in column to use with text for title

Dim myRng as range
dim myMin as double
dim myMax as Double

set myrng = worksheets("somesheetname").range("thedynamicnamer angehere")

if application.count(myrng) = 0 then
'no numbers, what should happen?
mymin = -999999
mymax = 999999
else
mymin = application.min(myrng)
mymax = application.max(myrng)
end if

Then you can use mymin and mymax in your code.

Dim mytitle as string
.....

mytitle = "ww" & format(mymin,"#,##0.00") & "-" & format(mymax,"#,##0.00") _
& "failure pareto..."

You may not want the formats.

rc wrote:

I would like to find the maximum and minimum values (integers) in a column of
dynamic size. Then I will plug these values into the title of a chart, i.e.
"WW17-26 Failure Pareto..."

I can identify the dynamic range but can't get MAX() or LARGE() instructions
to assign the largest value to a variable that I can use in the chart title
in vba. I can find a solution by using =MAX("DynamicRange") inside a cell,
but not sure how to get this into the title of a chart that is created
through vba.

Thanks for any help,
rc


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
RC RC is offline
external usenet poster
 
Posts: 39
Default MAX value in column to use with text for title

I keep getting a type mismatch error...and debugger takes me to mymin =
application.min(myrng) line.

rc


"Dave Peterson" wrote:

Dim myRng as range
dim myMin as double
dim myMax as Double

set myrng = worksheets("somesheetname").range("thedynamicnamer angehere")

if application.count(myrng) = 0 then
'no numbers, what should happen?
mymin = -999999
mymax = 999999
else
mymin = application.min(myrng)
mymax = application.max(myrng)
end if

Then you can use mymin and mymax in your code.

Dim mytitle as string
.....

mytitle = "ww" & format(mymin,"#,##0.00") & "-" & format(mymax,"#,##0.00") _
& "failure pareto..."

You may not want the formats.

rc wrote:

I would like to find the maximum and minimum values (integers) in a column of
dynamic size. Then I will plug these values into the title of a chart, i.e.
"WW17-26 Failure Pareto..."

I can identify the dynamic range but can't get MAX() or LARGE() instructions
to assign the largest value to a variable that I can use in the chart title
in vba. I can find a solution by using =MAX("DynamicRange") inside a cell,
but not sure how to get this into the title of a chart that is created
through vba.

Thanks for any help,
rc


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default MAX value in column to use with text for title

What do you have in that range?

Do you have any errors in it?

Maybe you can remove the errors -- or change the formula to hide the error:

=if(iserror(yourformula),"",yourformula)



rc wrote:

I keep getting a type mismatch error...and debugger takes me to mymin =
application.min(myrng) line.

rc

"Dave Peterson" wrote:

Dim myRng as range
dim myMin as double
dim myMax as Double

set myrng = worksheets("somesheetname").range("thedynamicnamer angehere")

if application.count(myrng) = 0 then
'no numbers, what should happen?
mymin = -999999
mymax = 999999
else
mymin = application.min(myrng)
mymax = application.max(myrng)
end if

Then you can use mymin and mymax in your code.

Dim mytitle as string
.....

mytitle = "ww" & format(mymin,"#,##0.00") & "-" & format(mymax,"#,##0.00") _
& "failure pareto..."

You may not want the formats.

rc wrote:

I would like to find the maximum and minimum values (integers) in a column of
dynamic size. Then I will plug these values into the title of a chart, i.e.
"WW17-26 Failure Pareto..."

I can identify the dynamic range but can't get MAX() or LARGE() instructions
to assign the largest value to a variable that I can use in the chart title
in vba. I can find a solution by using =MAX("DynamicRange") inside a cell,
but not sure how to get this into the title of a chart that is created
through vba.

Thanks for any help,
rc


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
RC RC is offline
external usenet poster
 
Posts: 39
Default MAX value in column to use with text for title

No errors to my knowledge. See my code he

'create dynamic range to determine Range of WW
Dim WWRng As Range
Dim WWMin As Long
Dim WWMax As Long
Dim WWRange As Range

ActiveWorkbook.Names.Add Name:="WWRange", RefersToR1C1:= _
"=OFFSET('Data Sheet'!R1C1,1,7,CountA(C1),1)"
Range("WWRange").Select
With Selection.Interior
.ColorIndex = 8
.Pattern = xlSolid
End With

Set WWRng = Worksheets("Data Sheet").Range("WWRange")
If Application.Count(WWRng) = 0 Then
WWMin = 0
WWMax = 0
Else
WWMin = Application.Min(WWRng)
WWMax = Application.Max(WWRng)
End If


I just added the range selection and fill property to verify correct range
selected and it works fine.

Thanks,
rc



"Dave Peterson" wrote:

What do you have in that range?

Do you have any errors in it?

Maybe you can remove the errors -- or change the formula to hide the error:

=if(iserror(yourformula),"",yourformula)



rc wrote:

I keep getting a type mismatch error...and debugger takes me to mymin =
application.min(myrng) line.

rc

"Dave Peterson" wrote:

Dim myRng as range
dim myMin as double
dim myMax as Double

set myrng = worksheets("somesheetname").range("thedynamicnamer angehere")

if application.count(myrng) = 0 then
'no numbers, what should happen?
mymin = -999999
mymax = 999999
else
mymin = application.min(myrng)
mymax = application.max(myrng)
end if

Then you can use mymin and mymax in your code.

Dim mytitle as string
.....

mytitle = "ww" & format(mymin,"#,##0.00") & "-" & format(mymax,"#,##0.00") _
& "failure pareto..."

You may not want the formats.

rc wrote:

I would like to find the maximum and minimum values (integers) in a column of
dynamic size. Then I will plug these values into the title of a chart, i.e.
"WW17-26 Failure Pareto..."

I can identify the dynamic range but can't get MAX() or LARGE() instructions
to assign the largest value to a variable that I can use in the chart title
in vba. I can find a solution by using =MAX("DynamicRange") inside a cell,
but not sure how to get this into the title of a chart that is created
through vba.

Thanks for any help,
rc

--

Dave Peterson


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.misc
RC RC is offline
external usenet poster
 
Posts: 39
Default MAX value in column to use with text for title

I figured out what was happening. My dynamic range was one row too large and
included an erroneous cell. I fixed the range and all is well. Thanks for
your help Dave.

rc


"rc" wrote:

No errors to my knowledge. See my code he

'create dynamic range to determine Range of WW
Dim WWRng As Range
Dim WWMin As Long
Dim WWMax As Long
Dim WWRange As Range

ActiveWorkbook.Names.Add Name:="WWRange", RefersToR1C1:= _
"=OFFSET('Data Sheet'!R1C1,1,7,CountA(C1),1)"
Range("WWRange").Select
With Selection.Interior
.ColorIndex = 8
.Pattern = xlSolid
End With

Set WWRng = Worksheets("Data Sheet").Range("WWRange")
If Application.Count(WWRng) = 0 Then
WWMin = 0
WWMax = 0
Else
WWMin = Application.Min(WWRng)
WWMax = Application.Max(WWRng)
End If


I just added the range selection and fill property to verify correct range
selected and it works fine.

Thanks,
rc



"Dave Peterson" wrote:

What do you have in that range?

Do you have any errors in it?

Maybe you can remove the errors -- or change the formula to hide the error:

=if(iserror(yourformula),"",yourformula)



rc wrote:

I keep getting a type mismatch error...and debugger takes me to mymin =
application.min(myrng) line.

rc

"Dave Peterson" wrote:

Dim myRng as range
dim myMin as double
dim myMax as Double

set myrng = worksheets("somesheetname").range("thedynamicnamer angehere")

if application.count(myrng) = 0 then
'no numbers, what should happen?
mymin = -999999
mymax = 999999
else
mymin = application.min(myrng)
mymax = application.max(myrng)
end if

Then you can use mymin and mymax in your code.

Dim mytitle as string
.....

mytitle = "ww" & format(mymin,"#,##0.00") & "-" & format(mymax,"#,##0.00") _
& "failure pareto..."

You may not want the formats.

rc wrote:

I would like to find the maximum and minimum values (integers) in a column of
dynamic size. Then I will plug these values into the title of a chart, i.e.
"WW17-26 Failure Pareto..."

I can identify the dynamic range but can't get MAX() or LARGE() instructions
to assign the largest value to a variable that I can use in the chart title
in vba. I can find a solution by using =MAX("DynamicRange") inside a cell,
but not sure how to get this into the title of a chart that is created
through vba.

Thanks for any help,
rc

--

Dave Peterson


--

Dave Peterson

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
Column Title changes Suela5 Excel Discussion (Misc queries) 2 November 4th 06 08:50 PM
Find max value in a row and return column title Jshendel Excel Worksheet Functions 5 July 21st 06 05:23 PM
Named range=Column title,comumn title in cellB6 use B6in equation Graham Excel Discussion (Misc queries) 2 July 21st 06 10:03 AM
How to rename a column title in excel? atta New Users to Excel 5 May 23rd 06 04:12 AM
Sumif based on column A and title of another column Rusty Excel Discussion (Misc queries) 7 October 19th 05 12:28 AM


All times are GMT +1. The time now is 08:18 PM.

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

About Us

"It's about Microsoft Excel"