PDA

View Full Version : listbox multi selection problem



cenderus
10-02-2008, 02:54 PM
i have a userform that have more than 6 combobox in it and a textbox to users can write something;

when user selects with comboboxes this combobox gives colomns and rows to where users text value enter,


at first i use another combobox to select row but i see that its difficult wat cause users want to select multi rows somtimes so i turn to listbox and open its multiselection function but now it gives error at this code



Sheets(.Name).Range(.Cells(Row, Column).Address) = TextBox2.Value
at my user form combobox2 selects sheets ;

other combox select rows and colomns at this selected sheet

and user use textbox2 to entry


Private Sub CommandButton1_Click()
Dim rngHaftalar As Range
Dim rngHafta As Range
Dim rngAdresler As Range
Dim rngAdres As Range
Dim cell As Range
Dim Column As Integer
Dim Row As Integer

If ComboBox2.ListIndex < 0 Then: Exit Sub
If ComboBox3.ListIndex < 0 Then: Exit Sub
If ComboBox7.ListIndex < 0 Then: Exit Sub
If ListBox1.ListIndex < 0 Then: Exit Sub

With sh

Set rngHaftalar = .Range(.Cells(4, 5), .Cells(4, .Cells(4, 256).End(xlToLeft).Column))
Set rngHafta = rngHaftalar.Find(ComboBox3, Lookat:=xlWhole)

If Not rngHafta Is Nothing Then

If rngHafta.MergeCells Then


Set rngHafta = rngHafta.MergeArea
Set rngHafta = .Range(.Cells(28, rngHafta.Column), .Cells(28, rngHafta.Column + rngHafta.Columns.Count - 1))

For Each cell In rngHafta
If cell = ComboBox7 Then
Column = cell.Column
Exit For
End If
Next
End If
End If

Set rngAdresler = .Range(.Cells(29, 3), .Cells(.Cells(65536, 3).End(xlUp).Row, 3))
Set rngAdres = rngAdresler.Find(ListBox1, Lookat:=xlWhole)

If Not rngAdres Is Nothing Then
Row = rngAdres.Row
End If

Sheets(.Name).Range(.Cells(Row, Column).Address) = TextBox2.Value

End With
Set rngHaftalar = Nothing
Set rngHafta = Nothing
Set rngAdresler = Nothing
Set rngAdres = Nothing

End Sub

cenderus
10-02-2008, 03:39 PM
i attach a sample of my project

cenderus
10-04-2008, 03:29 PM
nobody knows this subject ?

Bob Phillips
10-05-2008, 03:52 AM
I think that everyone will be like me, that is, having no idea what you are trying to do.

You need to explain what it is all about and then we can try and help you resolve it.

cenderus
10-05-2008, 07:42 AM
i use this userform for a report menu;

user can take notes with this userform;

at this project combobox2 selects sheets at workbook;(area names)

combobox3 selects weeks
combobox4 selects saler
listbox1 takes data of products list

and user write mistakes or errors at a textbox and click save button and this textbox data entry to this products week-saler select cell;

i can do this when i use combobox before using listbox but at comboboz user can only select one product but some mistakes same more than one product so i want to use listbox object for it;

i open multi selectin of listbox object bu now it gives error at this code



Sheets(.Name).Range(.Cells(Row, Column).Address) = TextBox2.Value


i think it use only one row and at multi rows it gives error;

here my projects sample file ;