Consulting

Results 1 to 8 of 8

Thread: mouse over cell -> listbox

  1. #1
    VBAX Tutor
    Joined
    Jan 2008
    Posts
    266
    Location

    mouse over cell -> listbox

    hey all!
    im new here, and also quite new in VBA.

    i have a question, is it possible to make a macro that shows a listbox (or simular) when the cursor is above a cell.

    i have a excellsheet that contains a list of names and IPs (and other not so important stuff).
    in column G is where all the IPs are, and the list is growing each day.

    when i move my cursor over a cell in column G i want it to show a box with names that use the same IP.

    i think i can do the code for matching IP and names but i dont knwo how to make the box appear (and dissapear).

    help please


    EDIT: something like on this forum is what i had in mind, when your mouse is over a thread you can read the thread in a box. but with the names instead.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Post details of where the data is (columns, sheets, etc.) or preferably an example workbook.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Tutor
    Joined
    Jan 2008
    Posts
    266
    Location
    this is the file!

    EDIT: ohh.. it was too big. i had to cut it down alot in size, sorry for that

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    How about this? When you select an item in column G, it filters by that value, so you see all the associated names.

    It goes in the worksheet code module.

    [vba]

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim mpIPList As Variant
    Dim mpIPCount As Long
    Dim mpLastRow As Long

    Application.EnableEvents = False

    With Target

    If .Column = 7 And .Row > 5 Then

    If .Value <> "" Then

    ReDim mpIPList(1 To 1000)
    mpLastRow = Me.Cells(Me.Rows.Count, .Column).End(xlUp).Row
    .Cells.AutoFilter Field:=6, Criteria1:=.Value
    Set mpdata = .Cells(6, .Column).SpecialCells(xlCellTypeVisible)
    mpIPList = mpdata
    ' Me.Cells.AutoFilter
    End If

    Else
    .Cells.AutoFilter Field:=6
    End If
    End With

    Application.EnableEvents = True
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Tutor
    Joined
    Jan 2008
    Posts
    266
    Location
    Thank you!
    it works fine, but it creates a problem.
    i dont dare to get close to G column :-)
    and i cant select "across" G without the macro crashing, ex: G15-G16.

    when i copy in new data to the list it doesnt give me the option to use the textimport guide, but once the macro is crashed it works.

    is it possible to use the comments? if i would add a comment to each G-cell, is it possible to type on the comment trough a macro?

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    The crash is easily handled

    [vba]

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim mpIPList As Variant
    Dim mpIPCount As Long
    Dim mpLastRow As Long
    Dim mpdata As Range

    Application.EnableEvents = False

    With Target

    If .Cells.Count = 1 Then

    If .Column = 7 And .Row > 5 Then

    If .Value <> "" Then

    ReDim mpIPList(1 To 1000)
    mpLastRow = Me.Cells(Me.Rows.Count, .Column).End(xlUp).Row
    .Cells.AutoFilter Field:=6, Criteria1:=.Value
    Set mpdata = .Cells(6, .Column).SpecialCells(xlCellTypeVisible)
    mpIPList = mpdata
    ' Me.Cells.AutoFilter
    End If

    Else
    .Cells.AutoFilter Field:=6
    End If
    End If
    End With

    Application.EnableEvents = True
    End Sub
    [/vba]

    Quote Originally Posted by Ago
    is it possible to use the comments? if i would add a comment to each G-cell, is it possible to type on the comment trough a macro?
    I don't understand that bit.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    VBAX Tutor
    Joined
    Jan 2008
    Posts
    266
    Location
    if you look in H2 on my sheet there is this red thing at the top (i hope).
    when the mouse is over H2 a messagebox appears with information.

    what i mean was if its possible to use those perhaps?

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You can add a comment, but how would it get updated if that IP address is added to another cell? The only way would be to re-create every comment after each cell change, and that is ridiculous to me.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •