Consulting

Results 1 to 2 of 2

Thread: VBA knowing which cells it has filled?

  1. #1

    VBA knowing which cells it has filled?

    Since a VBA function unlike a sub allows you to select the cells you want, place the function in the bar on top, and then press CTRL+SHFT+ENTR to populate, is there a way for VBA without actually exiting the code to figure out which cells were populated?


    For example, would I be able to run a sub right before exiting the function which would determine which cells have been populated?


    Thanks!

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    You can use the sheet's Selection event or Application.OnKey.

    e.g.
    [VBA]Sub SetOnKey()
    MsgBox Selection.Address
    End Sub

    Sub SetOnKey_()
    Application.OnKey "^+{RETURN}", "SetOnKey"
    End Sub[/VBA]

Posting Permissions

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