Consulting

Results 1 to 3 of 3

Thread: Solved: someCell.activate and then showing up on screen

  1. #1
    VBAX Regular
    Joined
    Jan 2006
    Posts
    11
    Location

    Solved: someCell.activate and then showing up on screen

    Hi,
    i'm building a tool thatl loops through each cell in the workbook, but i want a cell that is actually activated to also show up on the screen, so the user sees what cell has just been activated.

    i thought that just activating the cell would be enough
    [vba]
    for each theCell in activeSheet.usedrange.cells
    if theCell.value="something" then
    theCell.activate
    end if
    next
    [/vba]
    but if i do something like this, the cell IS activated, but the user doesnt see anything happening on screen If that cell is not currently visible on the screen.
    this means that the user has to scroll down and stuff, instead of the activated cell being brought up for him to see.

    is that supposed to happen?
    or is there something like
    theCell.GetFocus

    or have i screwed something up with application.screenupdate=false or something like that



    thanx in advance!
    Last edited by Koesper; 02-06-2006 at 07:04 AM. Reason: added some info

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Quote Originally Posted by Koesper
    or have i screwed something up with application.screenupdate=false or something like that
    If you've used "application.screenupdate=false" then the screen won't update until you set it to True or exit the procedure you used it in.
    K :-)

  3. #3
    VBAX Regular
    Joined
    Jan 2006
    Posts
    11
    Location
    Ah... it did have to do with the screenupdating=false,
    but i thought it wouldnt because i did

    [VBA] application.screenupdating=false
    doSomething(theCell)
    theCell.activate
    application.screenupdating=true[/VBA]

    but after you set the screenupdating back to true, it doesnt try to refocus to the active cell...
    so if i just change the order to:

    [VBA] application.screenupdating=false
    doSomething(theCell)
    application.screenupdating=true
    theCell.activate[/VBA]

    the problem is solved...

    so perhaps i was already looking in the right direction, but i guess i just needed the nudge to look further :-)

    thanx anyway!

Posting Permissions

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