#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 281
Default VBA

Hi,

I have a Data Validation in my sheet and i want to write code that when data
Validation has changed the contents of 2 cells say D4 and D35 would cleared.
Any idea would be much appreciated.

Thanks,
--
Farhad Hodjat
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default VBA

Try using a worksheet change event.


Right click on the worksheet tab and select VIEW SOURCE.

Paste this

Private Sub Worksheet_Change(ByVal Target As Range)
Dim mySheet As Worksheet
Set mySheet = Target.Parent

If Target.Count 1 Then Exit Sub
If Not Intersect(Target, mySheet.Range("A1")) Is Nothing Then
'Change A1 above as needed.
mySheet.Range("D4").ClearContents
mySheet.Range("D35").ClearContents
End If
End Sub

--
HTH,
Barb Reinhardt



"Farhad" wrote:

Hi,

I have a Data Validation in my sheet and i want to write code that when data
Validation has changed the contents of 2 cells say D4 and D35 would cleared.
Any idea would be much appreciated.

Thanks,
--
Farhad Hodjat

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"