Consulting

Results 1 to 7 of 7

Thread: Solved: Clear cell not entire row

  1. #1

    Solved: Clear cell not entire row

    Need to clear just the cell and not the entire row. Here is the code that needs changing.


    [VBA] With ThisWorkbook.Sheets("Holidays")
    .Rows.EntireRow(i + 1).ClearContents[/VBA]

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Try:
            With ThisWorkbook.Sheets("Holidays")
                .Cells(i + 1, "C").ClearContents
            End With

  3. #3
    Didn't work but thanks for the try, I'll post all the code maybe that will help

  4. #4
    [VBA]Private Sub CommandButton_Remove_Click()
    Dim i As Long
    'change listbox name and sheet location to yours
    i = ListBox_Items.ListIndex + 1
    With ThisWorkbook.Sheets("Holidays")
    .Rows.EntireRow(i + 1).ClearContents
    End With
    populateBox
    End Sub[/VBA]

  5. #5
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Okay, this may be a dopey question, but just to clarify, you cahnged the column letter as needed, right?

    Cells(i + 1, "C").ClearContents

  6. #6
    GTO, that wasn't a dopey question. I changed the column letter and it works. So I thank you for asking the dopey question.

  7. #7
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    You bet 'Taz', always nice when it works out so quick

    (BTW, Warner Bros. rules! That stupid mouse can go jump!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •