O
Oufti
Hello,
I'm sure you'll all laugh out loud with this one, I'm sorry but I'm really
incompetent in programming.
The background: I'm trying to do a VBA script independant from the file where
it will be run, here's a part of it:
CurrentSheet = ActiveSheet.name
With Range("F:G")
Range("F8:G" & .Find("*", .Item(1), , , , xlPrevious).Row).Select
ActiveWorkbook.Names.Add name:="plot", RefersTo:=Selection.Address
End With
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData Source:=Sheets(CurrentSheet).Range("F8:G1889"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, name:=CurrentSheet
The source for the chart will always begin in F8 but the column height may
vary, that's why in need to replace 'Range("F8:G1889")' by a non dependant
expression, I tried placing "plot" as a range but with no success...
Please be patient with me, It's the first time I work in this soft (I'm a
graphist) I'm sure there's a simple solution, I tried storing the range in
variables with things like:
Dim PLage As Range
Set PLage = Range("F8:G1889")
It works but I dont know the G1889 in advance I know how to find it by the
last non null cell method but cant understand how integrate it here.
Thanks in advace for your help and sorry for my piggin english.
I'm sure you'll all laugh out loud with this one, I'm sorry but I'm really
incompetent in programming.
The background: I'm trying to do a VBA script independant from the file where
it will be run, here's a part of it:
CurrentSheet = ActiveSheet.name
With Range("F:G")
Range("F8:G" & .Find("*", .Item(1), , , , xlPrevious).Row).Select
ActiveWorkbook.Names.Add name:="plot", RefersTo:=Selection.Address
End With
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData Source:=Sheets(CurrentSheet).Range("F8:G1889"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, name:=CurrentSheet
The source for the chart will always begin in F8 but the column height may
vary, that's why in need to replace 'Range("F8:G1889")' by a non dependant
expression, I tried placing "plot" as a range but with no success...
Please be patient with me, It's the first time I work in this soft (I'm a
graphist) I'm sure there's a simple solution, I tried storing the range in
variables with things like:
Dim PLage As Range
Set PLage = Range("F8:G1889")
It works but I dont know the G1889 in advance I know how to find it by the
last non null cell method but cant understand how integrate it here.
Thanks in advace for your help and sorry for my piggin english.