PC Review


Reply
Thread Tools Rate Thread

How do I determine what key was pressed

 
 
=?Utf-8?B?bm90c28=?=
Guest
Posts: n/a
 
      7th Apr 2007
I have a sheet, the user has the option to filter the rows or see all rows.

If the user filters the rows I want my combo box to jump to the next visible
row. I must keep up with the selected value's row, because my code will
update other cells on the selected row.

If I type in the value, I only want the next visible cell value to show.

If I press the down key, I want the next visible cell value to show.

If I press the up key, I want the previous visible cell value to show.

Here's my code (it only works in one direction and it shows one hidden row
on the form before it shows the next visible row. If I press the up arrow, it
doesnt reverse search for the next visible row.)

Private Sub ComboBox1_Change()

Get_Next_Visible_Row

Userform.Show

End Sub

Private Sub Get_Next_Visible_Row()

ActiveCell.Offset(0, 0).Select

If ActiveCell.EntireRow.Hidden Then
i = UserForm2.ComboBox1.ListIndex
On Error Resume Next
Do While ActiveCell.EntireRow.Hidden
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop
UserForm2.ComboBox1.ListIndex = i - 1
End If

End Sub



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine Which Button Pressed =?Utf-8?B?TWlrZSBDb2xsaW5z?= Microsoft ASP .NET 14 23rd Aug 2006 02:36 PM
In LostFocus sub, can I determine which button was pressed? =?Utf-8?B?TWFyayBQYXJlbnQ=?= Microsoft Access Form Coding 1 10th May 2006 08:38 PM
How can you determine if the Laptop Fn key is pressed? =?Utf-8?B?c2NwYXJrZXI2Mg==?= Microsoft Dot NET Framework Forms 0 5th Jan 2005 06:39 AM
determine which key is pressed in control? Steve Microsoft VB .NET 3 3rd Mar 2004 08:49 PM
Re: How to determine when the _left_ ALT button is pressed David Lowndes Microsoft VC .NET 4 29th Jul 2003 06:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:59 AM.