O
Ozbobeee
Hi,
Excel 2003.
I have a ComboBox allowing the user to select an item number from a
dropdown, after which a number of other ComboBoxes on UserForm1 are
populated.
I have the following code:
General Declaration:
Option Explicit
Public iRow As Long ' = ActiveCell.Row
Code attached to ComboBox1:
Private Sub ComboBox1_Change()
' Retrieve data previously entered
Dim sh As Worksheet
Dim FndRng As Range
Dim i As Long
If Me.ComboBox1.MatchFound Then
' Populate CAR data in UserForm
Set sh = ThisWorkbook.Sheets("Data")
Set FndRng = sh.Columns(1).Find(Me.ComboBox1.Value, , , xlWhole)
Me.TextBox1.Value = FndRng.Offset(0, 1).Value
Etc. etc
End Sub
Also on the UserForm I have a "Next" button.
Code attached to "Next" button:
Private Sub CommandButton4_Click()
iRow = iRow + 1
ComboBox1.Value = Sheets("Data").Cells(iRow, 1).Value
Etc. etc
Me.Caption = "CAR " & iRow - 1
If iRow > 1 Then CommandButton4.Enabled = True
End Sub
At the moment if the "Next" button is clicked Row 1 data is returned,
then
Row 2 data etc with each click.
What I would like to do is enable ComboBox1 to either allow user
selection
of a number or increment the selected number each time the "Next"
button is
clicked.
E.g.
User selects say number 10 from ComboBox1 (other ComboBoxes are
populated).
User clicks "Next" button - ComboBox1 value becomes 11 and other
ComboBoxes
are populated.
User clicks "Next" button again - ComboBox1 value becomes 12 and
other
ComboBoxes are populated
Any assistance appreciated
Cheers
Bob.
Excel 2003.
I have a ComboBox allowing the user to select an item number from a
dropdown, after which a number of other ComboBoxes on UserForm1 are
populated.
I have the following code:
General Declaration:
Option Explicit
Public iRow As Long ' = ActiveCell.Row
Code attached to ComboBox1:
Private Sub ComboBox1_Change()
' Retrieve data previously entered
Dim sh As Worksheet
Dim FndRng As Range
Dim i As Long
If Me.ComboBox1.MatchFound Then
' Populate CAR data in UserForm
Set sh = ThisWorkbook.Sheets("Data")
Set FndRng = sh.Columns(1).Find(Me.ComboBox1.Value, , , xlWhole)
Me.TextBox1.Value = FndRng.Offset(0, 1).Value
Etc. etc
End Sub
Also on the UserForm I have a "Next" button.
Code attached to "Next" button:
Private Sub CommandButton4_Click()
iRow = iRow + 1
ComboBox1.Value = Sheets("Data").Cells(iRow, 1).Value
Etc. etc
Me.Caption = "CAR " & iRow - 1
If iRow > 1 Then CommandButton4.Enabled = True
End Sub
At the moment if the "Next" button is clicked Row 1 data is returned,
then
Row 2 data etc with each click.
What I would like to do is enable ComboBox1 to either allow user
selection
of a number or increment the selected number each time the "Next"
button is
clicked.
E.g.
User selects say number 10 from ComboBox1 (other ComboBoxes are
populated).
User clicks "Next" button - ComboBox1 value becomes 11 and other
ComboBoxes
are populated.
User clicks "Next" button again - ComboBox1 value becomes 12 and
other
ComboBoxes are populated
Any assistance appreciated
Cheers
Bob.