+ Reply to Thread
Results 1 to 3 of 3

Selecting multiple ranges with a macro

  1. #1
    Registered User
    Join Date
    10-03-2007
    Posts
    16

    Selecting multiple ranges with a macro

    If I have gaps of multiple rows in my data set and I want to write a macro that will for example perform an if loop to see if the cell value in the column it is looping through is not blank or equal to a header name and then select the multiple ranges.

    I.e.

    If cell.value not equal to (blank or header name)
    copy and paste into another worksheet

    That's the jist of the macro I want to write but I'm rather a beginner with using a macro to select ranges. So any help would be greatly appreciated.

  2. #2
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105
    Is it ok to delete the rows that contain blanks? If so, VBA Noob offers this solution:

    Please Login or Register  to view this content.
    You could also autofilter on blanks, and delete the rows that appear, then turn autofilter off again. All blank rows will be gone.

    Yet another method would be:

    Please Login or Register  to view this content.
    I use this code to start at row 1010 and move upwards, deleting rows that have blanks in the 12th column (adjustable for you), all the way to row 5.

  3. #3
    Registered User
    Join Date
    10-03-2007
    Posts
    16

    Can't delete the blank rows

    Unfortunately the blank rows are subtotals so some of the columns have valid information that I need to use.

    I would just like to copy the values that aren't blank in the columns without having to do it manually and skipping past the blank row or row that has a subtotal in it.

+ 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