VB Excel file multiple opening from a folder problem

I

icar

I am trying to write a macro that will open files one by one from a
folder, do stuff, plot a graph and then save them, close them and open
up the next file. My problem is that the way I have it written , I can
open the first one, do everything, and then once it opens the second
one, it still has the name of the first file as the name of the sheet
shown as the source of the plot. I tried to use .FoundFiles(i) instead
of the actual name but that gave an error. That is how I get to loop
through the files but how can I get it to work for the sheet name. Help
will be appreciated. Thanks,

Icar

This is the part of the code:

ActiveChart.ChartType = xlXYScatterSmooth
ActiveChart.SetSourceData
Source:=Sheets("IN-coarse-anm-00001").Range("C1:C31"),
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject,
Name:="IN-coarse-anm-00001"
With ActiveChart
 
T

Tom Ogilvy

Source:=Worksheets(1).Range("C1:C31"),

Might be what you want, but hard to tell with the limited information you
provided.
 

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