Thread: Listbox Code
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Listbox Code

Daviv, Is the text "No Change" a message in the validation box or is it a
text value in the cell?

"Daviv" wrote:

JLG,

It did not worked. Anymore help welcome.

--
Thanks!


"JLGWhiz" wrote:

This is untested:

Private Sub Worksheet_Change()
If Range("C1")= "No Change" Then
Range("A1") = ""
Range("B2") = ""
End If
End Sub

The dots are normally used in conjunction with a "With" statement and to get
a null value in the cell, omit the space between the quote marks. Also the
code will work better in a Worksheet code module as opposed to the
ThisWorkbook module.



"Daviv" wrote:

I have a cell containing a validation listbox. I want to write a code such
that if the user select "No Change", Cell A1 and B2 becomes blank. Below is
my code which is not working:

Private Sub Workbook_Change()
If .Range("C1")= "No Change" Then
.Range("A1") = " "
.Range("B2") = " "
End If
End Sub

Thanks for your help in advance.

--
Thanks!