+ Reply to Thread
Results 1 to 3 of 3

VBA to delete cells without moving cells

Hybrid View

  1. #1
    Registered User
    Join Date
    05-14-2009
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    14

    VBA to delete cells without moving cells

    I need to create a VBA code that will delete the contents of a cell without moving the cell location. I have tried the following code with the clear contents; however that does not satisfy the needs of the sheet that this information is going to. The only way I can make the cells truly clear is to press 'delete' in each cell. There is a long range of cells and this is taking way too much time. I could really use some help.

    This is what I have, but it does not meet my needs.

    For Each cell In Range("C7:R1006")
    If cell = 0 Then cell.ClearContents
    Next cell

    Thanks

    Chris

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: VBA to delete cells without moving cells

    ClearContents is the same as Del as far as I can see.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA to delete cells without moving cells

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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