ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   BRAND NEW USER -: PROBLEMS WITH LIST AND TEXT BOX INPUT (https://www.excelbanter.com/excel-programming/387695-brand-new-user-problems-list-text-box-input.html)

[email protected]

BRAND NEW USER -: PROBLEMS WITH LIST AND TEXT BOX INPUT
 
BRAND NEW USER -: PROBLEMS WITH LIST AND TEXT BOX INPUT


I WOULD GREATLY APPRECIATE HELP WITH THESE PROBLEMS

1) I have a 3 sheet workbook
on sheet 2 I have a userform with a text box and a list box

my text box wont enter data anywhere I type data into it and when
I hit enter
it simply points to an undefined command button on the userform
I've got this code so far



What I want it to do is enter the data in ??????????????


2) I have a list box with no data in it.
I cant work out how to get the data to display in it

What I want it to do is

The list box is on sheet 2

"products" is Sheet 1
"clients" is Sheet 2
Sheet 3 is called "smmary"

But I want it to get the data from products entered on sheet 1 in
column "A"
Beginning at A2 and
display it for selection

I've used this code but nothing goes anywhere


Private Sub TextBox2_Change()

Dim TextBox2 As TextBox

Dim iRow As Long
Dim iCol As Long

Dim shtClientAdd As Worksheet
Set shtClientAdd = _
Application.Workbooks("Fiddling").Worksheets("clie nts")
TextBox2 = TextBox
With shtClientAdd
iRow = .Cells(.Rows.Count, "A").End(xlUp). _
Offset(1, 0).Row
iCol = .Cells(1, .Columns.Count).End(xlToLeft). _
Offset(0, 1).Column
End With

End Sub



I've also inexpertly hacked this into the userform code

Private Sub ClientForm_Initialize()

'declare variables
Dim strid As String, rngData As Range, rngCell As Range
'assigns address of Product Names to rngData variables
Set rngData = _
Application.Workbooks("Fiddling.xls").Worksheets(" products") _
.Range("A2").ProductName '.strProductName
'assign column heading to strid variable
strid = "strProductName"
'sort sales data THEN ADD ONLY UNIQUE ID'S
'TO LIST BOX
rngData.Sort.key1 = strid ', header:=x1Yes
For Each rngCell In rngData.Columns(1).Cells
If rngCell.Value < strid Then
ListBox1.AddItem rngCell.Value
strid = rngCell.Value
End If
Next rngCell
End Sub
Private Sub ListBox1_Click()


Dim ListBox1 As ListBox
'select ............default list box
'lstBox1.ListIndex = 0
'select default option button
'optTotal.Value = True
ListBox1.AddItem "M&M's plain (500g)"
ListBox1.AddItem "M&M's peanut (500g)"
ListBox1.AddItem "Cadbury Cherry Ripe Bars (300g)"
ListBox1.AddItem "Cadbury Twirl Bars (300g)"
ListBox1.AddItem "Cadbury Caramello Bars (300g)"
ListBox1.AddItem "Cadbury Snack Bars (300g)"
ListBox1.AddItem "Cadbury Peppermint Bars (300g)"
ListBox1.AddItem "Cadbury Hazelnut Bars (300g)"

End Sub

From the notes Ive got the value property in the properties is

significant
But it seems useless to me...I cannot enter string data there

I would appreciate any useful code or advice



All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com