PDA

View Full Version : Solved: Clear cell not entire row



RonNCmale
04-15-2010, 03:58 AM
Need to clear just the cell and not the entire row. Here is the code that needs changing.


With ThisWorkbook.Sheets("Holidays")
.Rows.EntireRow(i + 1).ClearContents

GTO
04-15-2010, 04:26 AM
Try:

With ThisWorkbook.Sheets("Holidays")
.Cells(i + 1, "C").ClearContents
End With

RonNCmale
04-15-2010, 04:30 AM
Didn't work but thanks for the try, I'll post all the code maybe that will help

RonNCmale
04-15-2010, 04:31 AM
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

GTO
04-15-2010, 04:34 AM
Okay, this may be a dopey question, but just to clarify, you cahnged the column letter as needed, right?

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

RonNCmale
04-15-2010, 04:38 AM
GTO, that wasn't a dopey question. I changed the column letter and it works. So I thank you for asking the dopey question.

GTO
04-15-2010, 04:54 AM
:) You bet 'Taz', always nice when it works out so quick:thumb

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