Results 1 to 4 of 4

Dynamic Cell Address on MouseOver

Threaded View

  1. #1
    Registered User
    Join Date
    08-28-2017
    Location
    Langley, BC, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    2

    Dynamic Cell Address on MouseOver

    Hello!

    This is my first post here, so I hope I don't unintentionally step on any forum rules.

    I've been poking around on several websites and forums for the last couple of weeks in an attempt to answer my questions, but I think I might have confused myself more than anything else, so its time to ask for help. I have to say up front, though, that I am a complete beginner when it comes to programming.

    What I have managed to get working with the help of someone's three year old post on another forum (sorry, I have lost track of which forum it was on, but I do thank the person who posted it for their help) is to get a mouse over event working on a specific cell (sheet1, cell C14 in my file), then searches for the value in that cell on sheet3. Once the value is found on sheet3, a two column offset is performed and the value of that cell is applied to the merged cell, A1, on sheet1.

    Okay, at this point I have two problems I hope someone may be able to help me with:

    Firstly, the mouse over event is static to cell C14 on sheet1. I have been trying to find a way to detect and apply the cell address dynamically to the code I have [valueToFind = xlWorkSheet.Range("C14").Value], but I haven't been able to figure that out. Any help in this area would be appreciated.

    Secondly, the mouse over event works great on the one cell, the search on the other sheet works, the offset works, and the placing of the offset value from sheet3 to cell A1 on sheet1 works. What I want to have happen, and which currently doesn't work properly, is that once the mouse is moved out of the cell (C14 right now) I want the value in A1 to be erased.

    I'm not sure if this is a case of me just not having the code for this [xlWorkSheet.Range("A1").Value = " "] in the right place, or if there is something else that I need to do first (yes, I know it is currently commented out). Again, any help with this would be appreciated.

    Sub MouseOverEvent()
    
        Dim xlRange As Range
        Dim xlCell As Range
        Dim xlWorkSheet As Worksheet
        Dim xlDataSheet As Worksheet
        Dim iLastRow As Integer
        Dim iRow As Integer
        Dim bFound As Boolean
        Dim valueToFind As String
    
        bFound = False
        Set xlWorkSheet = ActiveWorkbook.Worksheets("Sheet1")
        Set xlDataSheet = ActiveWorkbook.Worksheets("Sheet3")
        
        valueToFind = xlWorkSheet.Range("C14").Value
        iLastRow = xlDataSheet.Range("A1").End(xlDown).Row
        
        Set xlRange = xlDataSheet.Range("A1:A" & iLastRow)
    
        For Each xlCell In xlRange
            If xlCell.Value = valueToFind Then
                bFound = True
                iRow = xlCell.Row
            End If
    
            If bFound Then Exit For
        Next xlCell
                
        xlWorkSheet.Range("A1").Value = xlCell.Offset(, 2)
        'xlWorkSheet.Range("A1").Value = " "
    
    End Sub
    Attached Files Attached Files
    Last edited by Wasperine; 09-02-2017 at 04:15 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: 01-16-2014, 11:48 AM
  2. I Want to know how I can make this formula into vba code for dynamic cell address
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2013, 02:41 PM
  3. [SOLVED] I Want to know how I can make this formula into vba code for dynamic cell address
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2013, 12:54 PM
  4. Dynamic flexible cell address
    By dewsbury in forum Excel General
    Replies: 2
    Last Post: 03-09-2006, 04:10 PM
  5. ADDRESS function - dynamic input cell
    By claytorm in forum Excel General
    Replies: 1
    Last Post: 06-28-2005, 09:05 AM
  6. Goto a dynamic cell address within a macro
    By blkane in forum Excel General
    Replies: 3
    Last Post: 06-08-2005, 03:05 PM
  7. [SOLVED] Goto a dynamic cell address within a macro
    By blkane in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-08-2005, 02:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1