+ Reply to Thread
Results 1 to 2 of 2

Offset selection based on selected cells not just activecell

  1. #1
    Registered User
    Join Date
    02-25-2014
    Location
    Grand Rapids, MI
    MS-Off Ver
    Excel 2013
    Posts
    26

    Offset selection based on selected cells not just activecell

    Guys,
    I'm trying build a macro that will select the blank cells in a column and then using some sort of offset to select cells to the right of them. For example, if I select the blanks in column "B" cells b1,b5, and b8 may get highlighted. If those are selected then I want the macro to select cells b1-f1,b5-f5, and b8-f8. My next step in the macro will be to delete the selected cells and shift the cells up.

    This is what I'm using so far, the problem is that it only selects based on the active cell and not the selected cells.
    Columns("B:B").Select
    Range("B6").Activate
    Selection.SpecialCells(xlCellTypeBlanks).Select

    Range(ActiveCell, Cells(ActiveCell.Row, ActiveCell.Column + 6)).Select

    Thanks,

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Offset selection based on selected cells not just activecell

    Something like
    Please Login or Register  to view this content.
    Although there is no need to Select the range, it can be deleted directly

    Please Login or Register  to view this content.
    Working with discontinuous ranges can be tricky. Some properties and methods (like .Cells and .Resize) work from the first cell in the range. But others (like .EntireRow) work on all the .Areas of a discontinuous range.
    Last edited by mikerickson; 11-28-2015 at 12:22 PM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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. [SOLVED] vba code for selecting cells based on activecell
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-01-2015, 02:23 AM
  2. Cell offset based on number of cells in selection
    By jerrydiaz in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-17-2014, 09:27 AM
  3. Selected row based on combobox selection
    By SlappyDikkinz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2014, 11:26 AM
  4. Clear cell contents based on offset of dropdown selection on another tab.
    By Drivium in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2013, 10:58 PM
  5. Searching for an Offset Value based on Combo Box Selection
    By CaddyMatt in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2012, 01:33 PM
  6. Function with "ActiveCell.Offset(x, y).value" not calculating cells automatically?
    By Skywalker in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-20-2011, 03:17 AM
  7. Offset from multiple selected cells
    By JP Romano in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-06-2011, 04:55 PM

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