View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Denis[_7_] Denis[_7_] is offline
external usenet poster
 
Posts: 2
Default [VBA] Convert string to Range

Hi,
I would like to know how I can convert a string in a range.

I write what I did:
I have one sheet with inside four charts (grafichs).
In this charts I have only to insert the source data.

<----------------------------------------------------------------------
Private Sub Crea_grafico(foglio As String, tabella As String,
nome_tabella As String, foglio2 As String, marca As String)
Dim WB As Workbook
Dim SH As Worksheet
Dim area_grafico As Range
Dim area As String

Set WB = Workbooks(nuova_cartella)
Set SH = WB.Sheets(foglio)

' Here I determine the variable area
' area as this kind of value "I15,K15,P15,Z15,I39,K39,P39,Z39"
<------- I checked it with debug and it's ok

Set area_grafico = SH.Range(area)
' Here the macro stops with a '1004 Error'
' The strange behavoiur is that after it stops, I press F8 and the
instruction is ok and the macro goes on very well.

Sheets(foglio_grafici).ChartObjects("Grafico 2").Activate
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=SH.Range(area), PlotBy:=xlRows
<----------------------------------------------------------------------

I use Excel 2003 SP2 (Italian version)
Who can help me??

Thanks in advance!!!!

--
Ciao Denis

Arriva un momento nella vita in cui non rimane altro da fare che
percorrere la propria strada fino in fondo...
Quello e' il momento di inseguire i propri sogni, quello e' il momento
di prendere il largo, forti delle proprie convinzioni.