Hello guys,
I made filtered ComboBox, which is done by using SpecialCells(xlCellTypeVisible), but now I have a problem with data paste. RowIndex, which I use for this, count all rows, not just the filtered rows. Is there a way, how to do something like this:
RowIndex.SpecialCells(xlCellTypeVisible) = Me.ComboBox1.ListIndex ?
Here is the code, which I need to "repair"
Any help you can offer would be hugely appreciated.
Code
Private Sub cmdSave2_Click()
Dim RowIndex As Long
RowIndex = Me.ComboBox2.ListIndex + 6
Dim Status As String
Status = UserForm1.txtInWarhouse.Value
If UserForm1.txtInWarhouse.Value = True Then
Status = "Na skladě"
Else
Status = "Poškozeno"
End If
If Sheets("Položky").Cells(RowIndex, 6).Value = "Na skladě" Or Sheets("Položky").Cells(RowIndex, 6).Value = "Poškozeno" Then
MsgBox ("Položka je již vrácena"), vbCritical, "Duplicitní vrácení"
Exit Sub
End If
If ComboBox2.Value = "" Then
MsgBox ("Musí být zvolena položka pro vrácení"), vbCritical, "Chybná volba položky"
Exit Sub
End If
With Me
Sheets("Položky").Cells(RowIndex, 11).Value = .txtComment2.Value
Sheets("Položky").Cells(RowIndex, 7).Value = ""
Sheets("Položky").Cells(RowIndex, 6).Value = Status
Reset_List
ClearList
Me.ComboBox2.ListIndex = RowIndex - 6
MsgBox ("Položka byla úspěšně vrácena"), vbInformation, "Úspěch!"
txtInWarhouse = True
End With
End Sub
Display More