+ Reply to Thread
Results 1 to 5 of 5

Clear selection?

  1. #1
    StargateFanFromWork
    Guest

    Clear selection?

    I've made do with using this for now:

    ActiveCell.Offset(0, 0).Select

    I'd found Selection.Clear, I believe it was, in the archives but when I
    tested it, it literally wiped everything in the selection rather than just
    removing the selection. In other words, even the conditional formatting was
    removed, too. Is there something better than the above code, then, for
    this? The above simplistic approach does the job, but it's probably a
    ham-handed way of doing this.

    Thanks! :oD



  2. #2
    L. Howard Kittle
    Guest

    Re: Clear selection?

    You don't need to select to clear a cell or a range.

    ActiveCell.Offset(0, 0).ClearContents

    However, if you are setting row/column to 0 then just use

    ActiveCell.ClearContents

    HTH
    Regards,
    Howard

    "StargateFanFromWork" <[email protected]> wrote in message
    news:[email protected]...
    > I've made do with using this for now:
    >
    > ActiveCell.Offset(0, 0).Select
    >
    > I'd found Selection.Clear, I believe it was, in the archives but when I
    > tested it, it literally wiped everything in the selection rather than just
    > removing the selection. In other words, even the conditional formatting
    > was
    > removed, too. Is there something better than the above code, then, for
    > this? The above simplistic approach does the job, but it's probably a
    > ham-handed way of doing this.
    >
    > Thanks! :oD
    >
    >




  3. #3
    StargateFanFromWork
    Guest

    Re: Clear selection?

    Hi!

    Yes I do. I'm very sorry I was not clear. I _should_ have stated what I
    needed to clear the range for. Sorry 'bout that.
    "ActiveCell.ClearContents" did not work whereas "ActiveCell.Offset(0,
    0).ClearContents" did and does. In a "delete row(s)" macro I have, after it
    deletes the rows with "Selection.EntireRow.Delete", if a range was used
    rather than deleting just the row the cursor was on, the selection remains
    which makes the whole thing clunky. I had code to move the cursor over by
    one cell in any direction by using a variation on "ActiveCell.Offset(-1,
    0).ClearContents", so I played with that until I got something that worked
    in clearing the selection, yet keeping the cursor in the same active cell as
    before deletion without clearing conditional formatting, etc. The (0,0)
    variation above works but I imagine it's not quite correct to use that and
    there's probably something better. Despite searching in the archives, I
    didn't have luck this time (not asking with right terminology, I'm guessing
    <sigh>).

    So, my original question still stands of whether or not there is a better
    way to clear a selection without taking the cursor out of the cell
    co-ordinate one started out with.

    Thanks much. :oD

    ****************************************
    "L. Howard Kittle" <[email protected]> wrote in message
    news:[email protected]...
    > You don't need to select to clear a cell or a range.
    >
    > ActiveCell.Offset(0, 0).ClearContents
    >
    > However, if you are setting row/column to 0 then just use
    >
    > ActiveCell.ClearContents
    >
    > HTH
    > Regards,
    > Howard
    >
    > "StargateFanFromWork" <[email protected]> wrote in message
    > news:[email protected]...
    > > I've made do with using this for now:
    > >
    > > ActiveCell.Offset(0, 0).Select
    > >
    > > I'd found Selection.Clear, I believe it was, in the archives but when I
    > > tested it, it literally wiped everything in the selection rather than

    just
    > > removing the selection. In other words, even the conditional formatting
    > > was
    > > removed, too. Is there something better than the above code, then, for
    > > this? The above simplistic approach does the job, but it's probably a
    > > ham-handed way of doing this.
    > >
    > > Thanks! :oD




  4. #4
    Tom Ogilvy
    Guest

    Re: Clear selection?

    ActiveCell.Select

    will change a multicell selection to just the activecell being selected.
    Using offset(0,0) is superflous.

    Not sure how ClearContents got into the converstation. You have talked
    about

    ActiveCell.Offset(0, 0).Select
    then suddenly started talking about
    ActiveCell.Offset(0,0).ClearContents


    So what you intend with "clear selection" remains ambiguous since select and
    clear are entirely different concepts.

    --
    Regards,
    Tom Ogilvy

    "StargateFanFromWork" <[email protected]> wrote in message
    news:[email protected]...
    > Hi!
    >
    > Yes I do. I'm very sorry I was not clear. I _should_ have stated what I
    > needed to clear the range for. Sorry 'bout that.
    > "ActiveCell.ClearContents" did not work whereas "ActiveCell.Offset(0,
    > 0).ClearContents" did and does. In a "delete row(s)" macro I have, after

    it
    > deletes the rows with "Selection.EntireRow.Delete", if a range was used
    > rather than deleting just the row the cursor was on, the selection remains
    > which makes the whole thing clunky. I had code to move the cursor over by
    > one cell in any direction by using a variation on "ActiveCell.Offset(-1,
    > 0).ClearContents", so I played with that until I got something that worked
    > in clearing the selection, yet keeping the cursor in the same active cell

    as
    > before deletion without clearing conditional formatting, etc. The (0,0)
    > variation above works but I imagine it's not quite correct to use that and
    > there's probably something better. Despite searching in the archives, I
    > didn't have luck this time (not asking with right terminology, I'm

    guessing
    > <sigh>).
    >
    > So, my original question still stands of whether or not there is a better
    > way to clear a selection without taking the cursor out of the cell
    > co-ordinate one started out with.
    >
    > Thanks much. :oD
    >
    > ****************************************
    > "L. Howard Kittle" <[email protected]> wrote in message
    > news:[email protected]...
    > > You don't need to select to clear a cell or a range.
    > >
    > > ActiveCell.Offset(0, 0).ClearContents
    > >
    > > However, if you are setting row/column to 0 then just use
    > >
    > > ActiveCell.ClearContents
    > >
    > > HTH
    > > Regards,
    > > Howard
    > >
    > > "StargateFanFromWork" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I've made do with using this for now:
    > > >
    > > > ActiveCell.Offset(0, 0).Select
    > > >
    > > > I'd found Selection.Clear, I believe it was, in the archives but when

    I
    > > > tested it, it literally wiped everything in the selection rather than

    > just
    > > > removing the selection. In other words, even the conditional

    formatting
    > > > was
    > > > removed, too. Is there something better than the above code, then,

    for
    > > > this? The above simplistic approach does the job, but it's probably a
    > > > ham-handed way of doing this.
    > > >
    > > > Thanks! :oD

    >
    >




  5. #5
    StargateFan
    Guest

    Re: Clear selection?

    On Tue, 10 Jan 2006 19:49:40 -0500, "Tom Ogilvy" <[email protected]>
    wrote:

    >ActiveCell.Select


    Great will try this.

    >will change a multicell selection to just the activecell being selected.
    >Using offset(0,0) is superflous.


    I thought it might be but didn't know what else to use. Thanks.

    >Not sure how ClearContents got into the converstation. You have talked


    See L. Howard Kittle's post.

    >about
    >
    >ActiveCell.Offset(0, 0).Select
    >then suddenly started talking about
    >ActiveCell.Offset(0,0).ClearContents
    >
    >
    >So what you intend with "clear selection" remains ambiguous since select and
    >clear are entirely different concepts.


    Your ActiveCell.Select seems to do the same as what I was trying to do
    with the only knowledge I had. Thanks.

    >--
    >Regards,
    >Tom Ogilvy
    >
    >"StargateFanFromWork" <[email protected]> wrote in message
    >news:[email protected]...
    >> Hi!
    >>
    >> Yes I do. I'm very sorry I was not clear. I _should_ have stated what I
    >> needed to clear the range for. Sorry 'bout that.
    >> "ActiveCell.ClearContents" did not work whereas "ActiveCell.Offset(0,
    >> 0).ClearContents" did and does. In a "delete row(s)" macro I have, after

    >it
    >> deletes the rows with "Selection.EntireRow.Delete", if a range was used
    >> rather than deleting just the row the cursor was on, the selection remains
    >> which makes the whole thing clunky. I had code to move the cursor over by
    >> one cell in any direction by using a variation on "ActiveCell.Offset(-1,
    >> 0).ClearContents", so I played with that until I got something that worked
    >> in clearing the selection, yet keeping the cursor in the same active cell

    >as
    >> before deletion without clearing conditional formatting, etc. The (0,0)
    >> variation above works but I imagine it's not quite correct to use that and
    >> there's probably something better. Despite searching in the archives, I
    >> didn't have luck this time (not asking with right terminology, I'm

    >guessing
    >> <sigh>).
    >>
    >> So, my original question still stands of whether or not there is a better
    >> way to clear a selection without taking the cursor out of the cell
    >> co-ordinate one started out with.
    >>
    >> Thanks much. :oD
    >>
    >> ****************************************
    >> "L. Howard Kittle" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > You don't need to select to clear a cell or a range.
    >> >
    >> > ActiveCell.Offset(0, 0).ClearContents
    >> >
    >> > However, if you are setting row/column to 0 then just use
    >> >
    >> > ActiveCell.ClearContents
    >> >
    >> > HTH
    >> > Regards,
    >> > Howard
    >> >
    >> > "StargateFanFromWork" <[email protected]> wrote in message
    >> > news:[email protected]...
    >> > > I've made do with using this for now:
    >> > >
    >> > > ActiveCell.Offset(0, 0).Select
    >> > >
    >> > > I'd found Selection.Clear, I believe it was, in the archives but when

    >I
    >> > > tested it, it literally wiped everything in the selection rather than

    >> just
    >> > > removing the selection. In other words, even the conditional

    >formatting
    >> > > was
    >> > > removed, too. Is there something better than the above code, then,

    >for
    >> > > this? The above simplistic approach does the job, but it's probably a
    >> > > ham-handed way of doing this.
    >> > >
    >> > > Thanks! :oD

    >>
    >>

    >



+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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