Loading
Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports



Results 1 to 4 of 4

Thread: VBA to Clear Contents of Every Alternate Cell in a Column

  1. #1
    Join Date
    6th February 2016
    Location
    Perth, WA
    Posts
    72

    VBA to Clear Contents of Every Alternate Cell in a Column

    I need to clear the contents of every alternate cell in a column, starting at cell C10, then C12 . . . . all the way down the column. I've searched for guidance but everything I've found to date relates to deleting entire rows or entire columns.

    Help with VBA coding to achieve this will be much appreciated.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    10th January 2007
    Location
    Borneo
    Posts
    2,899

    Re: VBA to Clear Contents of Every Alternate Cell in a Column

    Try this
    VB:
    Sub ClearAlternateCells() 
        Dim x, i As Long, lRow As Long 
         
        With ActiveSheet 
            lRow = .Cells(.Rows.Count, 3).End(xlUp).Row 
            With .Range("c10:c" & lRow) 
                x = .Value 
                For i = 1 To UBound(x, 1) Step 2 
                    x(i, 1) = vbNullString 
                Next 
                .Value = x 
            End With 
        End With 
         
    End Sub 
    
    
    We now have a reputation system in place. It can be found on the 'Star' icon on the bottom left hand side of the post

  3. #3
    Join Date
    6th February 2016
    Location
    Perth, WA
    Posts
    72

    Re: VBA to Clear Contents of Every Alternate Cell in a Column

    Perfect! Does exactly what I needed.

    Thank you very much for your prompt and effective response.

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    10th January 2007
    Location
    Borneo
    Posts
    2,899

    Re: VBA to Clear Contents of Every Alternate Cell in a Column

    You're welcome.
    We now have a reputation system in place. It can be found on the 'Star' icon on the bottom left hand side of the post

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Clear cell contents based on value in specific column
    By Dirider in forum Excel General
    Replies: 12
    Last Post: March 13th, 2011, 04:15
  2. Find Last Cell in Column and Clear Contents
    By Jerry1234 in forum Excel General
    Replies: 2
    Last Post: November 20th, 2010, 21:12
  3. Clear Contents Starting With First Blank Cell In Column
    By jlsprink in forum Excel General
    Replies: 2
    Last Post: November 4th, 2006, 09:21
  4. clear contents of rows based on cell contents in column
    By billgras in forum Excel General
    Replies: 3
    Last Post: October 23rd, 2005, 09:00

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
  •  
porno