ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,280
- Office Version
- 2007
- Platform
- Windows
Hi,
I currently have the code shown.
I would like a code that would check my worksheet GRASS in column S for a value.
If a value is present then when the customer is selected from the drop down list TextBox10 will show that value BUT is the cell is empty then TextBox 10 would show £0.00
I think i can do it for 1 cell but not sure how to do it as there are multiple cells.
Thanks
I currently have the code shown.
Rich (BB code):
Private Sub UserForm_Initialize()
Dim i As Long, LastRow As Long
LastRow = Sheets("GRASS").Range("A" & Rows.Count).End(xlUp).Row
If Me.ComboBox1.ListCount = 0 Then
For i = 3 To LastRow
Me.ComboBox1.AddItem Sheets("GRASS").Cells(i, "A").Value
Next i
End If
ComboBox1.Value = "SELECT NAME"
ComboBox1.SetFocus
End Sub
Private Sub ComboBox1_Change()
Dim i As Long, LastRow As Long
LastRow = Sheets("GRASS").Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Sheets("GRASS").Cells(i, "A").Value = (Me.ComboBox1) Or _
Sheets("GRASS").Cells(i, "A").Value = Val(Me.ComboBox1) Then
Me.TextBox1 = Sheets("GRASS").Cells(i, "C").Value
Me.TextBox2 = Sheets("GRASS").Cells(i, "E").Value
Me.TextBox3 = Sheets("GRASS").Cells(i, "I").Value
Me.TextBox4 = Sheets("GRASS").Cells(i, "G").Value
Me.TextBox5 = Sheets("GRASS").Cells(i, "O").Value
Me.TextBox6 = Format(Sheets("GRASS").Cells(i, "K").Value, "£#,##0.00")
Me.TextBox7 = Sheets("GRASS").Cells(i, "M").Value
Me.TextBox8 = Sheets("GRASS").Cells(i, "Q").Value
Me.TextBox9 = Sheets("GRASS").Cells(i, "U").Value
Me.TextBox10 = Format(Sheets("GRASS").Cells(i, "S").Value, "£#,##0.00")
Me.TextBox11 = Sheets("GRASS").Cells(i, "W").Value
Me.TextBox12 = Sheets("GRASS").Cells(i, "Y").Value
Exit For
End If
Next
End Sub
I would like a code that would check my worksheet GRASS in column S for a value.
If a value is present then when the customer is selected from the drop down list TextBox10 will show that value BUT is the cell is empty then TextBox 10 would show £0.00
I think i can do it for 1 cell but not sure how to do it as there are multiple cells.
Thanks