-
Solved: Loop Until Help
What I have is a User form with a combobox and a textbox on it.
My combobox is useing a Rowsource which is located on sheet5 starting at cell a1.
When the user makes a selection from the Combobox i need excel to activate the cell which that selection is in.
My code is as follows and it breaks every time at "ActiveCell.Offset(0, 1).Select"
I have the code working elsewhere so i am confused why it wont work here.
[vba]
Private Sub ComboBox1_Change()
Sheets("sheet5").Activate
Range("A1").Select
Do
If ActiveCell <> ComboBox1 Then
ActiveCell.Offset(0, 1).Select
End If
Loop Until ActiveCell = ComboBox1
End Sub
[/vba]
Example of working code referenced above.
[vba]
Private Sub addbtn_Click()
Sheets("sheet2").Activate
Range("A2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
[/vba]
any guidance would be appreciated.
(using excel 2010)
This code fixed it sorry about the unneeded post. =P
[vba]
Private Sub ComboBox1_Click()
Sheets("sheet5").Activate
Range("A1").Select
Do
If ActiveCell <> ComboBox1 Then
ActiveCell.Offset(0, 1).Select
End If
Loop Until ActiveCell = ComboBox1
End Sub
[/vba]
Last edited by elasez; 02-20-2013 at 07:24 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules