Excuse the crappy layout! Making pretty isn't worth it till it works!
I am creating a form which displays sales records. The problem I have is when displaying the quantity, sku, Title, price. Ideally a table would work perfectly, but I can't figure out if this is possible. It does auto populate, but I've left generic info on the pic.
Crappy pic pointing to the text boxes in question.The title tends to be a few lines long, I need to set the item Title txtbox to be a set width but an auto height. I then need the quantity, sku and price txtboxes to match the height of the quantity txtbox. I'm looking for an invoice style layout.
At present I'm only working on the first item, I'll need to add the second item after this, hence why I want these to align.
Current code pinched from the fabulous interwebz:
Option Explicit
'Where the procedure called Findit is called after Enter is clicked.
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then
Findit
End If
End Sub
Private Sub Findit() 'Find and populate the records with Excel VBA
Dim fnd As Range
Dim Search As String
Dim sh As Worksheet
Dim i As Integer
Set sh = Sheet9
Search = TextBox1.Text
Set fnd = sh.Columns("A:A").Find(Search, , , xlWhole)
If fnd Is Nothing Then
MsgBox "No Person Found", , "Error"
TextBox1.Text = ""
Else
For i = 2 To 28 'There are 30? items in the userform.
Frm_sales.Controls("TextBox" & i).Text = sh.Cells(fnd.Row, i).Value
Next i
End If
End Sub
Apologies for my naivety. VBA is not something I practise, so while I'm not asking for complete answers, I'd appreciate being pointed in the right direction if anyone can advise, thanks!
Inkedscreen shot of sales sheet_LI.jpg
Bookmarks