Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Resetting a cell to null

  Asked By: Raynard    Date: Jan 29    Category: MS Office    Views: 682
  

I have a spreadsheet that essentially mirrors a survey form. The
user puts information in the cells (fields) and I have their
responses rollup up to a summary sheet. In the summary sheet I've
placed the category (field) names across the top. On the input sheet
there are some categories that have several responses and I've
handled that by putting a series of check boxes there with a label
name next to it. The functionality of migrating the information to
the summary sheet is working fine. My code finds the next blank cell
in that column and pastes the response. The troubles begin when my
user UNCHECKS the box. When that occurs I want the response removed
from the column and that's where I'm stuck. I tried getting around
it by recording a macro and using find and replace but it seems like
there has to be a easier way. I'm posting a sample of my code below:


Private Sub CheckBox1_Change()
Dim NextRow As Integer

If CheckBox1.Value = True Then
NextRow = Worksheets!Sheet2.Range("f65536").End(xlUp).Row + 1
Application.Worksheets("Sheet2").Cells(NextRow, 6) = "East"
End If

'If CheckBox1.Value = False Then
'Application.Worksheets("Sheet2").Cells(2, 6) = " "
'End If

End Sub


Private Sub CheckBox2_Change()
Dim NextRow As Integer

If CheckBox2.Value = True Then
NextRow = Worksheets!Sheet2.Range("f65536").End(xlUp).Row + 1
Application.Worksheets("Sheet2").Cells(NextRow, 6) = "West"
End If

'If CheckBox2.Value = False Then
'Application.Worksheets("Sheet2").Cells(2, 6) = " "
'End If

End Sub


Private Sub CheckBox3_Change()
Dim NextRow As Integer

If CheckBox3.Value = True Then
NextRow = Worksheets!Sheet2.Range("f65536").End(xlUp).Row + 1
Application.Worksheets("Sheet2").Cells(NextRow, 6) = "North"
End If
End Sub

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Renee Lane     Answered On: Jan 29

Can you use ClearContents?

Selection.ClearContents

 
Didn't find what you were looking for? Find more on Resetting a cell to null Or get search suggestion and latest updates.




Tagged: