Help w/ .Range(passing searched cells) I can't do it

O

osman

Hello All.. I am trying to automate my excel to run my usual charts(4 of
them). I am searching for particular information in a large file & I
want to graph the ones that I want. So i have programmed the searching
& cell finding but I cannot pass those addresses(cells ie: A1 to B50 to
graph)
Set F_cell = Cells.Find(what:="@sham_x") 'find first occurance
Set L_cell = Cells.FindPrevious(after:=ActiveCell) ' find last

Fst = F_cell.Address([ReferenceStyle:=xlA1]) 'F1 = $A$1
Lst = L_cell.Address([ReferenceStyle:=xlA1]) 'F2 = $A$50
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("*Fst:Lst*"), PlotBy:=xlColumns

I have to search at least 5 other catogories and graph them. I lack of
experience and reference books. All help would be greatly appreciated.

Thanks
 
M

mudraker

osman

You have included your variable names within "" This causes Excel to
see them as a continuos string

try

ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range(Fst & ":" &
Lst), PlotBy:=xlColumns
 

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