Ich habee ein kleines Problem :) Ich füge am Anfang den Inhalt einer Ascii Datei in ein neues Excel Worksheet ein. Nun möchte ich danach Direkt auf das neue Worksheet zugreifen und Alle Zeilen Mittig Stellen damit es ordentlicher aussieht. Doch jedesmal erscheint der Fehler 1004. Gegooglt hab ich schon und nur soetwas gefunden wie "das ich statt select durch Active" ersetzen soll. Doch alleine bekomm ich es glaub ich nicht hin. Könnte mir da vielleicht jemand helfen?
Mfg Dennis
Sub Start()
Dim a As Workbook
Dim w As Workbook
Dim f As Variant
Dim name As String
Set a = ActiveWorkbook
f = Application.GetOpenFilename("All Files (*.*),*.*")
If f <> False Then
Set w = Workbooks.Open(Filename:=f)
w.Sheets(1).Copy After:=a.Sheets(a.Sheets.Count)
w.Close SaveChanges:=False
Set w = Nothing
End If
Set a = Nothing
ActiveSheet.Range("A1").Select
Cells.Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
|