View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Visual basic functions

Hi Brett

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.




Dim varTemp As Variant

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("E1")) Is Nothing Then
If varTemp < Target Then Range("G3:G12").ClearContents
varTemp = Range("E1")
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

I'm very new to this area of Excel (i'm still studying at school) and i was
wondering if anyone could help me with some code to help me.

what i want to accomplish is to delete data in cells G3:G12 but i want it do
only be deleted when new information is entered into Cell E1. I also want to
be able to add values to Cells G3:G12 before they get deleted, and then be
able to add values afterward,

Thank you in advance, if anymore information is required, please specify and
i will do my best.