+ Reply to Thread
Results 1 to 3 of 3

Delete all of collumn after cell...

  1. #1
    Registered User
    Join Date
    09-23-2005
    Posts
    7

    Delete all of collumn after cell...

    Alright, we all know how to do this. How do I put it into code?
    This is what my employer told me.

    1. go to the column B
    2. hit <end> <down> and it goes to the last student.
    3. hit <Down arrow> once more (puts cursor below last active record).
    4. Select EVERY row from there to <end><Down> (bottom of excel sheet)
    5. <right click> and DELETE


    How on earth do I do this in VBCode?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Zlord,

    Like this...

    Find the next cell after the last record...
    StartCell = Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).Address

    Find the last cell on the Worksheet...
    LastCell = Cells(Rows.Count, "B").Address

    Select the the cells to be deleted...
    Range(StartCell, LastCell).Select

    Delete the cells...
    Selection.Delete


    Here's the Macro version. Insert a VBA module into your project . Copy and Paste this code into the module.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    Last edited by Leith Ross; 10-28-2005 at 08:24 PM.

  3. #3
    Gary Keramidas
    Guest

    Re: Delete all of collumn after cell...

    try recording a macro as you perform the steps

    --


    Gary


    "Zlord" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alright, we all know how to do this. How do I put it into code?
    > This is what my employer told me.
    >
    > 1. go to the column B
    > 2. hit <end> <down> and it goes to the last student.
    > 3. hit <Down arrow> once more (puts cursor below last active record).
    > 4. Select EVERY row from there to <end><Down> (bottom of excel
    > sheet)
    > 5. <right click> and DELETE
    >
    >
    > How on earth do I do this in VBCode?
    >
    >
    > --
    > Zlord
    > ------------------------------------------------------------------------
    > Zlord's Profile:
    > http://www.excelforum.com/member.php...o&userid=27519
    > View this thread: http://www.excelforum.com/showthread...hreadid=480285
    >




+ 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