Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.worksheet.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. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thank you very much! i have been trying so many things haha.
Pecoflyer, it is not necessarily homework, it's like a practice project where we try to learn how to use new functions, and i wanted to learn how to do this one. "Jacob Skaria" wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is Visual Basic the same as Visual Studio 2008? | Excel Worksheet Functions | |||
New to Visual Basic | Excel Discussion (Misc queries) | |||
Visual Basic | Excel Discussion (Misc queries) | |||
changing the visual basic in office 2003 to visual studio net | Excel Discussion (Misc queries) | |||
Visual Basic | Excel Discussion (Misc queries) |