PC Review


Reply
Thread Tools Rate Thread

Curly Question with a Combobox

 
 
Corey
Guest
Posts: n/a
 
      30th Jan 2007
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 With Quote
 
 
 
 
Corey
Guest
Posts: n/a
 
      30th Jan 2007
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
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 With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      30th Jan 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> 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 With Quote
 
Corey
Guest
Posts: n/a
 
      30th Jan 2007
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> 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 With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      30th Jan 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> 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 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
curly quotes became straight, can't get curly bakc John Worsley Simpson Microsoft Word Document Management 2 18th Jan 2010 07:17 PM
CURLY QUOTES Subligaria Microsoft Word Document Management 10 5th Apr 2009 02:22 PM
Right Curly Bracket Chris Microsoft Word Document Management 3 8th Apr 2008 06:13 PM
Curly quotes =?Utf-8?B?TWFyeSBBbm4=?= Microsoft Word Document Management 2 21st Nov 2007 09:23 PM
IE Save Hot Key? Curly question!! Stubbo of Oz Freeware 13 20th Dec 2005 06:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:44 AM.