Als Neuling in Sachen Makro-Erstellung habe ich ein Problem und hoffe, dass ihr mir helfen könnt. In einer Abfolge von Makros wird Worksheet (Tabelle2) gelöscht und neu hinzugefügt. Wie erreiche ich es, dass beim folgenden Makro die UserForm (nicht modal) geöffnet bleibt?
Gruß
Uwe
Sub Test()
Application.Visible = False
Application.ScreenUpdating = False
Load UserForm1
UserForm1.Show vbModeless
Dim x, y As Long, linenr As Long
With .VBProject.VBComponents(.Sheets("Tabelle2").CodeName).CodeModule
linenr = .CreateEventProc("SelectionChange", "Worksheet")
.InsertLines linenr + 1, "On Error Resume Next"
.InsertLines linenr + 2, "lastcell.Interior.ColorIndex = farbe"
.InsertLines linenr + 3, "farbe = Target.Interior.ColorIndex"
.InsertLines linenr + 4, "Target.Interior.ColorIndex = 22"
.InsertLines linenr + 5, "Set lastcell = Target"
End With
End With
Application.Visible = True
End Sub