+ Reply to Thread
Results 1 to 11 of 11

Locate cells that changes

  1. #1
    Registered User
    Join Date
    05-13-2019
    Location
    Eskilstuna
    MS-Off Ver
    Office 2016
    Posts
    45

    Locate cells that changes

    I have this code, that opens a form when something changes in certain columns. It works fine.

    But is there any way that I can locate in the form frmOvertimeFlex there after, exactly which cell that has been changed?

    Or is that something I should do before opening this form?

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,720

    Re: Locate cells that changes

    Add a line of code as follows
    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,353

    Re: Locate cells that changes

    You already know which cell has changed ... the Target. So just use its address.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    05-13-2019
    Location
    Eskilstuna
    MS-Off Ver
    Office 2016
    Posts
    45

    Re: Locate cells that changes

    Yes that kinda works, but I would really have a use of Target.Address in the form that I am opening - frmOvertimeFlex. Is there any way for me to send this Target.Address as a parameter to frmOvertimeFlex?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,353

    Re: Locate cells that changes

    You're welcome. Thanks for the rep.



    The easiest way would be to declare a public string variable and set it to Target.Address before showing the form.

  6. #6
    Registered User
    Join Date
    05-13-2019
    Location
    Eskilstuna
    MS-Off Ver
    Office 2016
    Posts
    45

    Re: Locate cells that changes

    Ok, thanks! But I have a lots of modules and forms, where should I declare it so the variable is availible in all of the application? Like a global variable? Because now I'm doing it on the woorksheet level, right before Worksheet_Change method and that is not working?

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,353

    Re: Locate cells that changes

    Like a global variable?
    Yes, in a standard module, either on its own or before any subroutines.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-13-2019
    Location
    Eskilstuna
    MS-Off Ver
    Office 2016
    Posts
    45

    Re: Locate cells that changes

    Yes, that is excatly how Im doing it, but it doesn't work for me:

    Please Login or Register  to view this content.
    But when Im calling the variable on the form frmOvertimeFlex, its not working. Its just sying the variable its not declared. And the spelling on the variable itself is ok.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,353

    Re: Locate cells that changes

    Yes, that is excatly how Im doing it, but it doesn't work for me:
    But it isn't.


    If the worksheet change event handler is in the right place, that is, in the worksheet module, then the declaration is in the wrong place.

    It needs to be, no MUST be in a standard module NOT a sheet module. I'm guessing that's why it says it's not found.

  10. #10
    Registered User
    Join Date
    05-13-2019
    Location
    Eskilstuna
    MS-Off Ver
    Office 2016
    Posts
    45

    Re: Locate cells that changes

    Thank you! I had some other issues that interfered with this one, but now it's working!

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,353

    Re: Locate cells that changes

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro to locate locate text string and copy/paste offset range
    By guystanley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-16-2014, 08:46 PM
  2. Replies: 3
    Last Post: 09-15-2014, 01:12 PM
  3. Replies: 4
    Last Post: 01-13-2014, 08:13 AM
  4. Locate and calculate only the empty cells
    By devcon in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-18-2011, 09:15 AM
  5. Command button to locate cells
    By Lar98ry in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2007, 03:35 AM
  6. [SOLVED] How locate merged cells in Excel
    By LESTEREDEN in forum Excel General
    Replies: 1
    Last Post: 09-08-2005, 03:05 PM
  7. Locate and delete specific cells
    By David Smith in forum Excel General
    Replies: 1
    Last Post: 01-19-2005, 01:06 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