I have issue which I hope someone can suggest a solution for.
I have several *.csv files in a folder, which my program can open and convert to *.xls-file. What I need to do is to make a chart in every new open *.xls in an certain range. The file name and sheet name is for example
"Wv_B-2_Fre" what is changing for each file is the number which is increased by one (the last part of the code below)
So my question is how do I make the code, so it create a chart in each open file. The code below only create chart in first file then it pop a alert code.
Thank you for your help,
[/code]
Selection.FormatConditions(1).StopIfTrue = False
ActiveWorkbook.SaveAs filename:=folderName & "" & Replace(myFile, ".txt", ".xlsx"), FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Range("B300039").Select
ActiveCell.FormulaR1C1 = "=MAX(R[-300001]C:R[-2]C)"
Range("B300040").Select
ActiveCell.FormulaR1C1 = "=MIN(R[-300002]C:R[-2]C)"
Range("B300041").Select
ActiveCell.FormulaR1C1 = "=(R[-2]C-R[-1]C)"
Range("A300039").Select
ActiveCell.FormulaR1C1 = "Max"
Range("A300040").Select
ActiveCell.FormulaR1C1 = "Min"
Range("A300041").Select
ActiveCell.FormulaR1C1 = "Diff"
'filename = ActiveWorkbook.Name
ActiveCell.FormulaR1C1 = filename
Range("B300020:B300037").Select
Range("B300037").Activate
ActiveSheet.Shapes.AddChart2(240, xlXYScatter).Select
ActiveChart.SetSourceData Source:=Range( _
"'Wv_Bursts-2_Fre_'!$B$300020:$B$300037")
I have several *.csv files in a folder, which my program can open and convert to *.xls-file. What I need to do is to make a chart in every new open *.xls in an certain range. The file name and sheet name is for example
"Wv_B-2_Fre" what is changing for each file is the number which is increased by one (the last part of the code below)
So my question is how do I make the code, so it create a chart in each open file. The code below only create chart in first file then it pop a alert code.
Thank you for your help,
[/code]
Selection.FormatConditions(1).StopIfTrue = False
ActiveWorkbook.SaveAs filename:=folderName & "" & Replace(myFile, ".txt", ".xlsx"), FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Range("B300039").Select
ActiveCell.FormulaR1C1 = "=MAX(R[-300001]C:R[-2]C)"
Range("B300040").Select
ActiveCell.FormulaR1C1 = "=MIN(R[-300002]C:R[-2]C)"
Range("B300041").Select
ActiveCell.FormulaR1C1 = "=(R[-2]C-R[-1]C)"
Range("A300039").Select
ActiveCell.FormulaR1C1 = "Max"
Range("A300040").Select
ActiveCell.FormulaR1C1 = "Min"
Range("A300041").Select
ActiveCell.FormulaR1C1 = "Diff"
'filename = ActiveWorkbook.Name
ActiveCell.FormulaR1C1 = filename
Range("B300020:B300037").Select
Range("B300037").Activate
ActiveSheet.Shapes.AddChart2(240, xlXYScatter).Select
ActiveChart.SetSourceData Source:=Range( _
"'Wv_Bursts-2_Fre_'!$B$300020:$B$300037")
Code: