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
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