i Everyone,
High school teacher from Australia here....trying to make a userform in excel by copying code from the internet, I got this code from here and combined it with another bit of code so it did two things I wanted.
I am trying to copy the contents of a ComboBox1 and TextBox1 into cell B2 and then following on each cell below, all it does is copy the contents into B2 and when I click it again, it copies the new contents into B2 so it looks like the second half of the code isn't working. Total newbie here - I'm just a mathematician so I really don't understand this code as much as literally anyone else here. Any suggestions would be so appreciated.
Private Sub CommandButton2_Click()
Sheets("Comments").Range("B2").Value = ComboBox1.Value & " " & TextBox1.Value
If Range("B2") = Empty Then
Range("B2") = selectedValue
Else
lrow = Cells(Rows.Count, 5).End(xlUp).Row
Cells(lrow + 1, 5) = selectedValue
End If
MsgBox ("Comment is copied")
End Sub
High school teacher from Australia here....trying to make a userform in excel by copying code from the internet, I got this code from here and combined it with another bit of code so it did two things I wanted.
I am trying to copy the contents of a ComboBox1 and TextBox1 into cell B2 and then following on each cell below, all it does is copy the contents into B2 and when I click it again, it copies the new contents into B2 so it looks like the second half of the code isn't working. Total newbie here - I'm just a mathematician so I really don't understand this code as much as literally anyone else here. Any suggestions would be so appreciated.
Private Sub CommandButton2_Click()
Sheets("Comments").Range("B2").Value = ComboBox1.Value & " " & TextBox1.Value
If Range("B2") = Empty Then
Range("B2") = selectedValue
Else
lrow = Cells(Rows.Count, 5).End(xlUp).Row
Cells(lrow + 1, 5) = selectedValue
End If
MsgBox ("Comment is copied")
End Sub