ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Variables and graphs (https://www.excelbanter.com/excel-discussion-misc-queries/62725-variables-graphs.html)

teepee

Variables and graphs
 
Quick question....

If I have a VBA saying

ActiveChart.SeriesCollection(1).Values = "=three!R3000C11:R4000tC11"

can I replace it with

ActiveChart.SeriesCollection(1).Values = "=three!RsetinC11:RsetoutC11"

where setin and setout are declared variables? I'm a bit hazy on the syntax
of this one.

Cheers

tp



Chip Pearson

Variables and graphs
 
Try

ActiveChart.SeriesCollection(1).Values = "=three!R" & setin &
"C11:" & Rsetout & "C11"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"teepee" wrote in message
...
Quick question....

If I have a VBA saying

ActiveChart.SeriesCollection(1).Values =
"=three!R3000C11:R4000tC11"

can I replace it with

ActiveChart.SeriesCollection(1).Values =
"=three!RsetinC11:RsetoutC11"

where setin and setout are declared variables? I'm a bit hazy
on the syntax of this one.

Cheers

tp




Dave Peterson

Variables and graphs
 
I think Chip meant:

ActiveChart.SeriesCollection(1).Values _
= "=three!R" & setin & "C11:R" & setout & "C11"



Chip Pearson wrote:

Try

ActiveChart.SeriesCollection(1).Values = "=three!R" & setin &
"C11:" & Rsetout & "C11"

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"teepee" wrote in message
...
Quick question....

If I have a VBA saying

ActiveChart.SeriesCollection(1).Values =
"=three!R3000C11:R4000tC11"

can I replace it with

ActiveChart.SeriesCollection(1).Values =
"=three!RsetinC11:RsetoutC11"

where setin and setout are declared variables? I'm a bit hazy
on the syntax of this one.

Cheers

tp


--

Dave Peterson

Chip Pearson

Variables and graphs
 
Yeah, that's what I meant. Fingers and brain weren't quite in
sync.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Dave Peterson" wrote in message
...
I think Chip meant:

ActiveChart.SeriesCollection(1).Values _
= "=three!R" & setin & "C11:R" & setout & "C11"



Chip Pearson wrote:

Try

ActiveChart.SeriesCollection(1).Values = "=three!R" & setin &
"C11:" & Rsetout & "C11"

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"teepee" wrote in message
...
Quick question....

If I have a VBA saying

ActiveChart.SeriesCollection(1).Values =
"=three!R3000C11:R4000tC11"

can I replace it with

ActiveChart.SeriesCollection(1).Values =
"=three!RsetinC11:RsetoutC11"

where setin and setout are declared variables? I'm a bit
hazy
on the syntax of this one.

Cheers

tp


--

Dave Peterson




teepee

Variables and graphs
 

"Dave Peterson" wrote

I think Chip meant:

ActiveChart.SeriesCollection(1).Values = "=three!R" & setin & "C11:R" &
setout & "C11"


Many thanks. I think it's worked but I won't know till I've figured out how
to set this darn variable in the first place8-)
It's in a userform button on mediaplayer as an object and it goes

Private Sub CommandButton4_Click()
UserForm1.Height = 230
Dim setin As Variant
setin = ActiveWorkbook.ActiveSheet.Cells(1, 2).Value
End Sub

It's supposed to take the value of the formula in cell B2 but at the moment
it's just returning 1 for everything. 8-(

tp



Chip Pearson

Variables and graphs
 
If you want the value from B2, you need to change
ActiveWorkbook.ActiveSheet.Cells(1, 2).Value
to
ActiveWorkbook.ActiveSheet.Cells(2, 2).Value
or
ActiveWorkbook.ActiveSheet.Range("B2").Value

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"teepee" wrote in message
...

"Dave Peterson" wrote

I think Chip meant:

ActiveChart.SeriesCollection(1).Values = "=three!R" & setin &
"C11:R" & setout & "C11"


Many thanks. I think it's worked but I won't know till I've
figured out how to set this darn variable in the first place8-)
It's in a userform button on mediaplayer as an object and it
goes

Private Sub CommandButton4_Click()
UserForm1.Height = 230
Dim setin As Variant
setin = ActiveWorkbook.ActiveSheet.Cells(1, 2).Value
End Sub

It's supposed to take the value of the formula in cell B2 but
at the moment it's just returning 1 for everything. 8-(

tp





teepee

Variables and graphs
 

"teepee" wrote

It's supposed to take the value of the formula in cell B2


I meant A2 of course



teepee

Variables and graphs
 

"Chip Pearson" wrote

ActiveWorkbook.ActiveSheet.Cells(2, 2).Value
or
ActiveWorkbook.ActiveSheet.Range("B2").Value


No still getting a 1 value.It's almost as though it won't accept a value
from a userform button on wmp when it is an active object.




All times are GMT +1. The time now is 04:45 AM.

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