Hi all,
in an excel sheet I have made the following:
A dblclick event shows a userform.
The userform picks up values from cells in the same row where the activecell is (where the dblclick is made).
Now I want to have a commandbutton in the userform that clears the userform and pick up value from the next row.
This is not a problem in a normal sheet, but if the sheet is filtered by autofiltering I can't figure out a code that goes to the next (visible) row.
The shortened code is:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
UserForm1.Show
End Sub
-------------
Private Sub UserForm_Initialize()
UserForm1.TextBox1.Value = ActiveCell.EntireRow.Cells(1, 1).Value
etc.etc.
End Sub
-------------
Private Sub CommandButton1_Click()
Unload UserForm1
ActiveCell.Offset(1, 0).Activate
UserForm1.Show
End Sub
--------------
Any ideas for changing the commandbutton1 to go to next row in an autofiltered sheet?
It should be quite easy, or...
Regards Claus
in an excel sheet I have made the following:
A dblclick event shows a userform.
The userform picks up values from cells in the same row where the activecell is (where the dblclick is made).
Now I want to have a commandbutton in the userform that clears the userform and pick up value from the next row.
This is not a problem in a normal sheet, but if the sheet is filtered by autofiltering I can't figure out a code that goes to the next (visible) row.
The shortened code is:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
UserForm1.Show
End Sub
-------------
Private Sub UserForm_Initialize()
UserForm1.TextBox1.Value = ActiveCell.EntireRow.Cells(1, 1).Value
etc.etc.
End Sub
-------------
Private Sub CommandButton1_Click()
Unload UserForm1
ActiveCell.Offset(1, 0).Activate
UserForm1.Show
End Sub
--------------
Any ideas for changing the commandbutton1 to go to next row in an autofiltered sheet?
It should be quite easy, or...
Regards Claus