+ Reply to Thread
Results 1 to 2 of 2

Clear contents of range

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Clear contents of range

    Hi everyone,

    I'm trying to clear the contents of a row within a specific column range if the associated cell in a different column is blank. I have the following code:

    Sheets("aaa").Range("B10:B2009").SpecialCells(xlCellTypeBlanks).Offset(0, 2).ClearContents
    This works great if I'm only selecting one cell to clear, but I need to be able to clear the cells in columns D:AF rather than just D. I'm not certain if offset can be used to select a range of cells in a row.

    Any ideas?

    Thanks!

  2. #2
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Clear contents of range

    edit: fixed
    Sheets("aaa").Range(Replace(Range("B10:B2009").SpecialCells(xlCellTypeBlanks).Offset(0, 2).Address, ":$D", ":$BD")).ClearContents
    Last edited by Neil_; 10-25-2016 at 01:24 PM.
    Frob first, tweak later

+ 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. Clear Contents specific range of many tables
    By salmasaied in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-05-2016, 04:01 PM
  2. [SOLVED] Clear contents for filtered range only
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-13-2016, 03:39 AM
  3. Clear contents in dynamic range
    By DCRAIG3389 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2015, 10:49 AM
  4. [SOLVED] If each cell in range equals 0 then clear contents of range and move to the next row
    By dagardner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-19-2014, 08:44 PM
  5. [SOLVED] Clear Range Contents
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2013, 07:06 AM
  6. [SOLVED] clear contents of range
    By KATIEexcel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-14-2012, 08:11 AM
  7. Clear contents of cells in a range, LEN=0
    By jenny_journalist in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-29-2009, 11:37 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