One userform to enter info by changing value in list box

sophs345

New Member
Joined
May 28, 2018
Messages
1
Hey everyone,

New to this forum!
Trying to look for a way to use one userform to enter several values in the same row by changing values in a list box.

The userform asks for name, sex, a listbox with options for clothes (jacket, shirt, pants), a text box to specify how many items, a text box to specify the size (4,6,8..), and a text box for observations.

In the same row (for the same person) i need a button that allows the person to enter information for each choice of clothes (changing the values in the listbox), and another button that will look for the next free row.

I have the following but it only runs the first If condition until the end of the For Loop.

I apologize if some of the strings are in spanish but the people I work for are spanish speakers.


--------------------------------------------

Code:
Private Sub CmdTransfer_Click()


Sheets("DatosTotal").Select
'ActiveSheet.Unprotect


Dim i As Integer
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("DatosTotal")


Sheets("DatosTotal").Range("B7").Select
'find first empty row in database




For iRow = 8 To 20


iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
   
ws.Cells(iRow, 2).Value = Me.txtNombres.Value
ws.Cells(iRow, 3).Value = Me.LBgenero.Value


    If (Me.LBprenda.Value = "CHAQUETAS") Then
        ws.Cells(iRow, 6).Value = Me.CBunid1.Value
        ws.Cells(iRow, 7).Value = Me.CBtalla.Value
        ws.Cells(iRow, 8).Value = Me.txtObs.Value
        Me.LBprenda.SetFocus
        If (Me.LBprenda.Value = "CHALECO") Then
            ws.Cells(iRow, 9).Value = Me.CBunid1.Value
            ws.Cells(iRow, 10).Value = Me.CBtalla.Value
            ws.Cells(iRow, 11).Value = Me.txtObs.Value
             If (Me.LBprenda.Value = "PANTALON") Then
                ws.Cells(iRow, 12).Value = Me.CBunid1.Value
                ws.Cells(iRow, 13).Value = Me.CBtalla.Value
                ws.Cells(iRow, 14).Value = Me.txtObs.Value
                  If (Me.LBprenda.Value = "FALDA") Then
                    ws.Cells(iRow, 15).Value = Me.CBunid1.Value
                    ws.Cells(iRow, 16).Value = Me.CBtalla.Value
                    ws.Cells(iRow, 17).Value = Me.txtObs.Value
                     If (Me.LBprenda.Value = "BLUSA") Then
                        ws.Cells(iRow, 18).Value = Me.CBunid1.Value
                        ws.Cells(iRow, 19).Value = Me.CBtalla.Value
                        ws.Cells(iRow, 20).Value = Me.txtObs.Value
                     End If
                  End If
             End If
        End If
    End If


Next


MsgBox "Datos han sido ingresados", vbOKOnly + vbInformation
'clear the data
Me.txtNombres.Value = ""
Me.LBgenero.Value = ""
Me.CBunid1.Value = ""
Me.CBtalla.Value = ""
Me.txtObs.Value = ""
Me.txtNombres.SetFocus
Sheets("DatosTotal").Select


End Sub
 
Last edited by a moderator:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top