VBA - Namen automatisch eintragen
18.11.2003 13:50:14
Simon
also ich öffne eine excel datei in welcher nur meine Makros gespeichert sind.
nun zieh ich eine .DBF Datei in mein excel. So eine Datei enhält nur eine reihe von vielen Zahlen.
Praktisch eine große Tabelle (Messwerte). Dann führ ich mein Makro aus. Und diese
Tabelle die mein Makro mir dann mit den Daten der .DBF zeichnet soll den Namen dieser .DBF-Datei haben (an der stelle Name = "7513113")Die Zeile mit dem Kommentar '31.10.03 fällt dann weg. Irgendwas klappt einfach nicht, hab aber keine ahnung was.
Sub Dia_75_zeichnen()
Dim Zeilen As String
Dim Name As String
Zeilen = Range("A65536").End(xlUp).Row
Name = "7513113"
Range("A:A,E:E,F:F,L:L").Select
Windows(Name + ".DBF").Activate
Range("L1").Activate
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets(Name).Range( _
"A1:A" + Zeilen + ",E1:F" + Zeilen + ",L1:L" + Zeilen), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = Mid(Name, 3, 2) + "." + Mid(Name, 5, 2) + "." + Mid(Name, 7, 2) '"31.10.03"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveChart.HasLegend = True
Selection.Position = xlBottom
ActiveChart.PlotArea.Select
ActiveChart.Legend.Select
With Selection.Border
.ColorIndex = 16
.Weight = xlThin
.LineStyle = xlContinuous
End With
Selection.Interior.ColorIndex = xlNone
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = 74
.MaximumScale = 76
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.ColorIndex = 3
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = xlNone
.MarkerForegroundColorIndex = xlNone
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 3
.Shadow = False
End With
ActiveChart.SeriesCollection(3).Select
With Selection.Border
.ColorIndex = 4
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = xlNone
.MarkerForegroundColorIndex = xlNone
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 3
.Shadow = False
End With
ActiveChart.SeriesCollection(1).Select
With Selection.Border
.ColorIndex = 5
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = xlNone
.MarkerForegroundColorIndex = xlNone
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 3
.Shadow = False
End With
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 50
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With
End Sub
Gruß und vielen Dank
Simon