Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 113
Default Visual basic 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 113
Default Visual basic 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
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is Visual Basic the same as Visual Studio 2008? Mike Stewart Excel Worksheet Functions 5 January 11th 09 04:58 PM
New to Visual Basic Need help with sumif Excel Discussion (Misc queries) 3 November 11th 08 07:46 PM
Visual Basic mcp201 Excel Discussion (Misc queries) 1 November 2nd 08 05:51 AM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM
Visual Basic Micos3 Excel Discussion (Misc queries) 9 June 28th 05 01:41 PM


All times are GMT +1. The time now is 03:14 PM.

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

About Us

"It's about Microsoft Excel"