+ Reply to Thread
Results 1 to 8 of 8

Change selection of cells to selection of rows

  1. #1
    Forum Contributor
    Join Date
    08-22-2012
    Location
    Czech republic
    MS-Off Ver
    Excel 2010
    Posts
    119

    Change selection of cells to selection of rows

    Dear All,
    while creating my macro, small push is needed. I have these - to select range.

    Please Login or Register  to view this content.
    In this range, I need to delete whole rows. On keyboard, Shift + spacebar and ctrl + minus.
    How can I do the same in macro?

    Task no. 2:
    As you can see, I would like to delete it from first empty cell in B column, to B506 - in my template, here another part starts.
    I need to delete afterwards part from first empty cells bellow B507 to B600. But - obviously, B600 will become sth else if I delete it. Any idea how to find it?


    (in other words - I need to delete empty rows in sheet "rozpad" and its position should vary. I need last row in each selection will rest, for better visual view.
    Rozpad - automat PV.xlsm)

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Change selection of cells to selection of rows

    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Change selection of cells to selection of rows

    This is how entire rows can be deleted in VBA.

    Range(ActiveCell, "B506").EntireRow.Delete


    i don't understand your description of what you want deleted, and Task #2
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Contributor
    Join Date
    08-22-2012
    Location
    Czech republic
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Change selection of cells to selection of rows

    Thank you very much both guys. Both ways are working as miracle. :-)

    About task 2:
    It seems I will be able to do it thanks to your help by myself.
    Many thanks.

  5. #5
    Forum Contributor
    Join Date
    08-22-2012
    Location
    Czech republic
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Change selection of cells to selection of rows

    One more almost same question....
    I found I can do it with autofilter meanwhile. Do you have any idea what is wrong in my code? I have copied it from some web...

    Please Login or Register  to view this content.
    Rozpad - automat PV v2.xlsm (last macro in module 2 named DeleteRowsBasedOnCriteria

    Thanks again.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Change selection of cells to selection of rows

    Try this...

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Change selection of cells to selection of rows

    Just one thing to add, if the cells are completely blank (i.e. not containing a value or a formula) you could also use:
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    08-22-2012
    Location
    Czech republic
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Change selection of cells to selection of rows

    You are amazing. I almost have it, but... oh, I have a great date today - thanks. (btw: it works :-) )

+ 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. How to change selection in two listboxes by changing selection in a third listbox
    By GIS2013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-01-2013, 02:39 PM
  2. Autolock Cells from a Drop Down List Selection and a Calendar Selection
    By John Anderson in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-04-2013, 10:54 AM
  3. change selection event firing before selection change
    By martindwilson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2009, 09:34 AM
  4. Change from Column Selection to Cell Selection
    By Lil Pun in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-16-2006, 06:15 PM
  5. Object Type of a selection... counting rows in a selection
    By Acid-Sky in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2005, 05:05 AM

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