Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default How do I determine what key was pressed

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recognize ALT key Pressed Steve Excel Programming 1 August 12th 06 10:51 PM
Has Delete Key been pressed? bw Excel Programming 2 March 20th 06 04:51 PM
What key was pressed? [email protected] Excel Programming 2 July 30th 05 09:12 AM
Was Delete Key pressed? HLong Excel Programming 1 July 5th 05 11:00 PM
Which button was pressed? Adrian[_4_] Excel Programming 7 April 28th 04 04:55 PM


All times are GMT +1. The time now is 03:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"