Automatically update graphs and equations

R

Rosencrantz

Hi again,

I know the code to update graphs and equations automatically when new
data is added using variable ranges, but I'm now trying to find a way
to avoid all of that typing so that these variable ranges will be
automatically created after data is entered and then when columns are
selected for a graph or equation, these variables will be automatically
implemented to avoid all of the typing and risk of human error. Any
thoughts or ideas of where I can get help on this?

Thanks in advance!
 
R

Rosencrantz

Well, in case anyone can help me, here's an update:

I am using this code:

Sub update()

Dim columns() As String
Dim length As Integer
Dim X As String
Dim y As String
Dim first As Integer
Dim second As Integer

Do
output = InputBox("Which column(s)? (up to two and in numeric
value)", "Ranges", "3, 4", , , "c:\Windows\Help\Procedure Help.hlp", 0)
length = Len(output)
Loop Until length < 8

If length > 0 Then
columns = Split(output)

X = columns(0)
y = columns(1)

first = Val(X)
second = Val(y)

Range(Cells(8, first), Cells(Rows.count, first).End(xlUp)).Name =
"first"
Range(Cells(8, second), Cells(Rows.count, second).End(xlUp)).Name =
"second"

Else
End If

End Sub

To get the ranges from the selected columns, but here are some things I
want to do with it now:

1) I want the graphs made from these columns to automatically use the
named ranges rather than selected ranges so I don't have to change the
graph at all.
2) Currently, I have to rerun the macro after I add new data to update
the graphs, and I would like it to run more like:
=OFFSET(Sheet1!$A$1,COUNTA($A:$A)-30,0,30
Does, where the graphs and equations are automatically updated when
using the named ranges.
3) And I can only currently have 2 named ranges. I would like the
ranges to be named after the column and the worksheet, but I can't
figure it out. It won't let me use a string variable instead of "first"
and "second".

If anyone has any thoughts, please let me know.

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top