Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Curly Question with a Combobox
If i set Application.ScreenUpdating = True,
when the user triggers the Combobox1 DropButtonClick_Event ( ), the userform that displays the Combobox stays in the centre of the screen and the page that contains the values listed in the Combobox appears in the back ground. With me so far? Now, the values of the Combobox.List are in Column A which can be seen in the background worksheet once the DropButtonClick event is triggered. Here is the Question : If I place my MOUSE over a value in the list, Can the WorkSheet in the background scroll Up/Down to Centre the Value or set the value to the top of the page? I have values i need to LOOK at that are in Column C 2-22 rows below the value in Column A. Is this possible? What does the Mouse Up, Mouse Down, Mouse Move event's do, is this it??? How can i code this if that is the case ?? Corey.... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Curly Question with a Combobox
I tried and pasted the below code into the MOUSEMOVE event,
I get the WorkSheet flickering but it does not scroll up or down at all?? Private Sub ComboBox3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) On Error Resume Next With Worksheets("InspectionData").Range("A:A") Set rngFound = .Find(What:=Me.ComboBox3.Value, After:=.Range("A1"), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False) rngFound.Offset(25, 0).Activate End With With ActiveWindow ..ScrollRow = ActiveCell.Row - Int(.VisibleRange.Rows.Count / 2) ..ScrollColumn = ActiveCell.Column - Int((.VisibleRange.Columns.Count - 1) / 2) End With On Error GoTo 0 Application.ScreenUpdating = True End Sub Can i replace the 'Me.Combobox3.Value' with a Me.Combobox3.SelectionHighlighted or similar ? Corey.... "Corey" wrote in message ... If i set Application.ScreenUpdating = True, when the user triggers the Combobox1 DropButtonClick_Event ( ), the userform that displays the Combobox stays in the centre of the screen and the page that contains the values listed in the Combobox appears in the back ground. With me so far? Now, the values of the Combobox.List are in Column A which can be seen in the background worksheet once the DropButtonClick event is triggered. Here is the Question : If I place my MOUSE over a value in the list, Can the WorkSheet in the background scroll Up/Down to Centre the Value or set the value to the top of the page? I have values i need to LOOK at that are in Column C 2-22 rows below the value in Column A. Is this possible? What does the Mouse Up, Mouse Down, Mouse Move event's do, is this it??? How can i code this if that is the case ?? Corey.... |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Curly Question with a Combobox
If multiselect is false, and the user selects the item, then it is
highlighted/selected and the Value of the combobox will hold that value. If you want to react to where the mouse is hovering, you will have to take cognizance of what is displayed in the list, and where the mouse is in proportion to the height of the box and the number of items in the list and manuever the sheet by calculating what item the mouse is over (would be my guess - and it would only be approximate, but if you are just "centering" the visible range, then that should be close enough). -- Regards, Tom Ogilvy "Corey" wrote in message ... I tried and pasted the below code into the MOUSEMOVE event, I get the WorkSheet flickering but it does not scroll up or down at all?? Private Sub ComboBox3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) On Error Resume Next With Worksheets("InspectionData").Range("A:A") Set rngFound = .Find(What:=Me.ComboBox3.Value, After:=.Range("A1"), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False) rngFound.Offset(25, 0).Activate End With With ActiveWindow .ScrollRow = ActiveCell.Row - Int(.VisibleRange.Rows.Count / 2) .ScrollColumn = ActiveCell.Column - Int((.VisibleRange.Columns.Count - 1) / 2) End With On Error GoTo 0 Application.ScreenUpdating = True End Sub Can i replace the 'Me.Combobox3.Value' with a Me.Combobox3.SelectionHighlighted or similar ? Corey.... "Corey" wrote in message ... If i set Application.ScreenUpdating = True, when the user triggers the Combobox1 DropButtonClick_Event ( ), the userform that displays the Combobox stays in the centre of the screen and the page that contains the values listed in the Combobox appears in the back ground. With me so far? Now, the values of the Combobox.List are in Column A which can be seen in the background worksheet once the DropButtonClick event is triggered. Here is the Question : If I place my MOUSE over a value in the list, Can the WorkSheet in the background scroll Up/Down to Centre the Value or set the value to the top of the page? I have values i need to LOOK at that are in Column C 2-22 rows below the value in Column A. Is this possible? What does the Mouse Up, Mouse Down, Mouse Move event's do, is this it??? How can i code this if that is the case ?? Corey.... |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Curly Question with a Combobox
Ummm,
Tom you LOST me there. "Cognizance" is not in my general day to day vocabulary. Actually never even heard of it, so i cannot work out where to go with it. I have formatted the Combobox to list 42 items. The Userform is positioned at the top of the page and Just right of the C Column. If the Mouse Move event cannot move the page with code, what is it trying to do when the screen flickers? Corey.... "Tom Ogilvy" wrote in message ... If multiselect is false, and the user selects the item, then it is highlighted/selected and the Value of the combobox will hold that value. If you want to react to where the mouse is hovering, you will have to take cognizance of what is displayed in the list, and where the mouse is in proportion to the height of the box and the number of items in the list and manuever the sheet by calculating what item the mouse is over (would be my guess - and it would only be approximate, but if you are just "centering" the visible range, then that should be close enough). -- Regards, Tom Ogilvy "Corey" wrote in message ... I tried and pasted the below code into the MOUSEMOVE event, I get the WorkSheet flickering but it does not scroll up or down at all?? Private Sub ComboBox3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) On Error Resume Next With Worksheets("InspectionData").Range("A:A") Set rngFound = .Find(What:=Me.ComboBox3.Value, After:=.Range("A1"), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False) rngFound.Offset(25, 0).Activate End With With ActiveWindow .ScrollRow = ActiveCell.Row - Int(.VisibleRange.Rows.Count / 2) .ScrollColumn = ActiveCell.Column - Int((.VisibleRange.Columns.Count - 1) / 2) End With On Error GoTo 0 Application.ScreenUpdating = True End Sub Can i replace the 'Me.Combobox3.Value' with a Me.Combobox3.SelectionHighlighted or similar ? Corey.... "Corey" wrote in message ... If i set Application.ScreenUpdating = True, when the user triggers the Combobox1 DropButtonClick_Event ( ), the userform that displays the Combobox stays in the centre of the screen and the page that contains the values listed in the Combobox appears in the back ground. With me so far? Now, the values of the Combobox.List are in Column A which can be seen in the background worksheet once the DropButtonClick event is triggered. Here is the Question : If I place my MOUSE over a value in the list, Can the WorkSheet in the background scroll Up/Down to Centre the Value or set the value to the top of the page? I have values i need to LOOK at that are in Column C 2-22 rows below the value in Column A. Is this possible? What does the Mouse Up, Mouse Down, Mouse Move event's do, is this it??? How can i code this if that is the case ?? Corey.... |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Curly Question with a Combobox
Cognizance:
1. awareness, realization, or knowledge; notice; perception: The guests took cognizance of the snide remark. Where the userform is located - I don't see that having any bearing on the problem I have formatted the Combobox to list 42 items. so all items are visible at once? If the Mouse Move event cannot move the page with code, what is it trying to do when the screen flickers? ?? I don't recall anyone saying the Mouse Move event could not move the page with code. Only you can tell why it flickers. Are you saying it is working as you wish? Not sure what the question is then. Anyway, this worked for me with minimal testing: Private Sub ListBox1_MouseMove(ByVal Button As Integer, _ ByVal Shift As Integer, ByVal X As Single, _ ByVal Y As Single) Dim rng as Range, v as double Dim ti as Long, li as Long Dim nrow as Long Set rng = Worksheets("Sheet1").Range("A1:A42") If ActiveSheet.Name < "Sheet1" Then rng.Parent.Activate nrow = ActiveWindow.VisibleRange.Columns(1).Cells.Count \ 2 v = (Y - ListBox1.Top) / (ListBox1.Height) numItemsInView = 12 ti = ListBox1.TopIndex li = CInt(v * numItemsInView) + ti If li -1 And li < ListBox1.ListCount - 1 Then If li <= nrow Then ActiveWindow.ScrollRow = 1 ElseIf li ListBox1.ListCount - nrow Then ActiveWindow.ScrollRow = ListBox1.ListCount - nrow - 1 Else ActiveWindow.ScrollRow = li - nrow End If End If End Sub ti is the top index in the listbox (first visible item) li is the list index over which the mouse is hovering Basically, as I previously stated, you figure out what the relative/proportional distance is of the mouse compared to the height of the listbox and translate that to a index position by multiplying that times the number of items visible, then adding the top index. Then translate the li into the source range and center that cell. My listbox had 42 items in the list, with 12 items visible in the listbox at any one time. Cells were in A1:A42. I just did the Vertical center. You will need to make adjustments if your range doesn't start in row 1. this is just starter code to give you some ideas. You will need to put in some sweat equity. -- Regards, Tom Ogilvy "Corey" wrote in message ... Ummm, Tom you LOST me there. "Cognizance" is not in my general day to day vocabulary. Actually never even heard of it, so i cannot work out where to go with it. I have formatted the Combobox to list 42 items. The Userform is positioned at the top of the page and Just right of the C Column. If the Mouse Move event cannot move the page with code, what is it trying to do when the screen flickers? Corey.... "Tom Ogilvy" wrote in message ... If multiselect is false, and the user selects the item, then it is highlighted/selected and the Value of the combobox will hold that value. If you want to react to where the mouse is hovering, you will have to take cognizance of what is displayed in the list, and where the mouse is in proportion to the height of the box and the number of items in the list and manuever the sheet by calculating what item the mouse is over (would be my guess - and it would only be approximate, but if you are just "centering" the visible range, then that should be close enough). -- Regards, Tom Ogilvy "Corey" wrote in message ... I tried and pasted the below code into the MOUSEMOVE event, I get the WorkSheet flickering but it does not scroll up or down at all?? Private Sub ComboBox3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) On Error Resume Next With Worksheets("InspectionData").Range("A:A") Set rngFound = .Find(What:=Me.ComboBox3.Value, After:=.Range("A1"), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False) rngFound.Offset(25, 0).Activate End With With ActiveWindow .ScrollRow = ActiveCell.Row - Int(.VisibleRange.Rows.Count / 2) .ScrollColumn = ActiveCell.Column - Int((.VisibleRange.Columns.Count - 1) / 2) End With On Error GoTo 0 Application.ScreenUpdating = True End Sub Can i replace the 'Me.Combobox3.Value' with a Me.Combobox3.SelectionHighlighted or similar ? Corey.... "Corey" wrote in message ... If i set Application.ScreenUpdating = True, when the user triggers the Combobox1 DropButtonClick_Event ( ), the userform that displays the Combobox stays in the centre of the screen and the page that contains the values listed in the Combobox appears in the back ground. With me so far? Now, the values of the Combobox.List are in Column A which can be seen in the background worksheet once the DropButtonClick event is triggered. Here is the Question : If I place my MOUSE over a value in the list, Can the WorkSheet in the background scroll Up/Down to Centre the Value or set the value to the top of the page? I have values i need to LOOK at that are in Column C 2-22 rows below the value in Column A. Is this possible? What does the Mouse Up, Mouse Down, Mouse Move event's do, is this it??? How can i code this if that is the case ?? Corey.... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserting curly brackets within a formula | Excel Worksheet Functions | |||
A curly date problem | Excel Discussion (Misc queries) | |||
Getting rid of curly brackets within formula | Excel Worksheet Functions | |||
Getting rid of curly brackets within formula | Excel Worksheet Functions | |||
Getting rid of curly brackets within formula | Excel Worksheet Functions |