Hello everyone,
since I am new to vba I am posting a quiete basic question. Ive been trying to figure this out for a while, but Im stuck...
In a first step I would like to know how to connect a text box from a macro with the ecxel sheet. --> How can I write values into this box and then read it from the datasheet. In a next step I will have to programm, that every time I am opening my userform for new values the values will be directl written underneah last entry, Ive made..
My code is here:
Private Sub ComboBox1_Change()
End Sub
Private Sub ComboBox2_Change()
End Sub
Private Sub CommandButton1_Click()
Cells(emptyRow, 1).Value = NameTextBox.Value
Unload Me
UserForm2.Show
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label2_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox2_Change()
End Sub
Private Sub TextBox9_Change()
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
' Nutzung --> Drop Box 1: Auswahl Nutzung
With UserForm1.ComboBox1
.AddItem "Wohnen MFH" 'gem?ss 2031 S.22
.AddItem "Wohnen EFH" 'gem?ss 2031 S.22
.AddItem "Verwaltung" 'gem?ss 2031 S.22
.AddItem "Schulen" 'gem?ss 2031 S.22
.AddItem "Verkauf" 'gem?ss 2031 S.22
.AddItem "Restaurants" 'gem?ss 2031 S.22
.AddItem "Versammlungslokale" 'gem?ss 2031 S.22
.AddItem "Spit?ler" 'gem?ss 2031 S.22
.AddItem "Industrie" 'gem?ss 2031 S.22
.AddItem "Lager" 'gem?ss 2031 S.22
.AddItem "Sportbauten" 'gem?ss 2031 S.22
.AddItem "Hallenb?der" 'gem?ss 2031 S.22
End With
' Nutzung --> Drop Box 2: Auswahl W?rmeerzeuger
With UserForm1.ComboBox2
.AddItem "W?rmepumpe"
.AddItem "Pelletsheizung"
.AddItem "St?ckholzheizung"
.AddItem "Holzschnitzelheizung (trocken)"
.AddItem "Holzschnitzelheizung (frisch)"
.AddItem "?lheizung"
.AddItem "Gasheizung (Erdgas)"
.AddItem "Gasheizung (Biogas)"
End With
End Sub
|