ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help w/ .Range(passing searched cells) I can't do it (https://www.excelbanter.com/excel-programming/360831-help-w-range-passing-searched-cells-i-cant-do.html)

osman

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

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


--
osman
------------------------------------------------------------------------
osman's Profile: http://www.excelforum.com/member.php...o&userid=34226
View this thread: http://www.excelforum.com/showthread...hreadid=539819


mudraker[_382_]

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

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


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=539819



All times are GMT +1. The time now is 05:35 PM.

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