Wenn ich meinen Code in VBA Word einfüge funktioniert der Code nicht da die Letzte Zeile im den erzeugten Excel Worksheet nicht gefunden wird . Kann mir wer sagen wieso ?
Private Sub CommandButton()
Dim xlApp As Object
Dim xlwb As Object
Dim xlws As Object
Dim last As Long
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlwb = xlApp.Workbooks.Add
Set xlws = xlwb.ActiveSheet
With xlws
.Range("A1:A10").Value = 1
last = .Cells(Rows.Count, 1).End(xlUp).Row
End With
Set xlws = Nothing
Set xlwb = Nothing
Set xlApp = Nothing
End Sub