Hallo,
gut vorab mal im Prinzip so, wenn's komplexer wird dann hör auf Alexandra...
Option Explicit
Private mobjWorkbook As Workbook
Private Sub CommandButton1_Click()
If mobjWorkbook Is Nothing Then Set mobjWorkbook = Workbooks.Add
With mobjWorkbook.ActiveSheet
.Cells(3, 1).Value = TextBox1.Value
.Cells(5, 4).Value = TextBox2.Value
.Cells(8, 7).Value = TextBox3.Value
.Cells(7, 1).Value = TextBox4.Value
End With
End Sub
Private Sub UserForm_Terminate()
Set mobjWorkbook = Nothing
End Sub
...oder einfach...
Private Sub CommandButton1_Click()
With Workbooks("MyBook.xlsm").ActiveSheet
.Cells(3, 1).Value = TextBox1.Value
.Cells(5, 4).Value = TextBox2.Value
.Cells(8, 7).Value = TextBox3.Value
.Cells(7, 1).Value = TextBox4.Value
End With
End Sub
Gruß,
|