PC Review


Reply
Thread Tools Rate Thread

Clearing cell contents

 
 
=?Utf-8?B?cmJiYmJlZWU=?=
Guest
Posts: n/a
 
      15th Dec 2006
I have a macro that when a name is entered in cell A1 a pop up window appears
asking for the birthday of the person who's name was entered. The birthday
date is then entered into cell A39. The macro works great this far. The
problem is that when the name of the person in cell A1 is deleted, I need to
have the birthday date also deleted in cell A39. What is the best way to do
this? Please help me soon!
See the coding below:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo stoppit
Application.EnableEvents = False
If Target.Address = "$A$1" And Target.Value <> "" Then
B_Day = InputBox("enter your birthday")
Range("A39").Value = B_Day
End If
stoppit:
Application.EnableEvents = True
End Sub

THANKS in advance!
Russ
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      15th Dec 2006
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim B_Day As String
On Error GoTo stoppit
Application.EnableEvents = False
If Target.Address = "$A$1" Then
If Target.Value = "" Then
Me.Range("A39").Value = ""
Else
B_Day = InputBox("enter your birthday")
Me.Range("A39").Value = B_Day
End If
End If
stoppit:
Application.EnableEvents = True
End Sub


rbbbbeee wrote:
>
> I have a macro that when a name is entered in cell A1 a pop up window appears
> asking for the birthday of the person who's name was entered. The birthday
> date is then entered into cell A39. The macro works great this far. The
> problem is that when the name of the person in cell A1 is deleted, I need to
> have the birthday date also deleted in cell A39. What is the best way to do
> this? Please help me soon!
> See the coding below:
>
> Private Sub Worksheet_Change(ByVal Target As Excel.Range)
> On Error GoTo stoppit
> Application.EnableEvents = False
> If Target.Address = "$A$1" And Target.Value <> "" Then
> B_Day = InputBox("enter your birthday")
> Range("A39").Value = B_Day
> End If
> stoppit:
> Application.EnableEvents = True
> End Sub
>
> THANKS in advance!
> Russ


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?cmJiYmJlZWU=?=
Guest
Posts: n/a
 
      15th Dec 2006
Thanks Dave! It works great!

Russ

"Dave Peterson" wrote:

> Option Explicit
> Private Sub Worksheet_Change(ByVal Target As Excel.Range)
> Dim B_Day As String
> On Error GoTo stoppit
> Application.EnableEvents = False
> If Target.Address = "$A$1" Then
> If Target.Value = "" Then
> Me.Range("A39").Value = ""
> Else
> B_Day = InputBox("enter your birthday")
> Me.Range("A39").Value = B_Day
> End If
> End If
> stoppit:
> Application.EnableEvents = True
> End Sub
>
>
> rbbbbeee wrote:
> >
> > I have a macro that when a name is entered in cell A1 a pop up window appears
> > asking for the birthday of the person who's name was entered. The birthday
> > date is then entered into cell A39. The macro works great this far. The
> > problem is that when the name of the person in cell A1 is deleted, I need to
> > have the birthday date also deleted in cell A39. What is the best way to do
> > this? Please help me soon!
> > See the coding below:
> >
> > Private Sub Worksheet_Change(ByVal Target As Excel.Range)
> > On Error GoTo stoppit
> > Application.EnableEvents = False
> > If Target.Address = "$A$1" And Target.Value <> "" Then
> > B_Day = InputBox("enter your birthday")
> > Range("A39").Value = B_Day
> > End If
> > stoppit:
> > Application.EnableEvents = True
> > End Sub
> >
> > THANKS in advance!
> > Russ

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing contents/lock cell ftahbaz@gmail.com Microsoft Excel Discussion 1 12th Oct 2006 08:51 PM
Clearing cell contents =?Utf-8?B?R2luYQ==?= Microsoft Excel Programming 2 4th May 2006 09:50 AM
Clearing Contents of Cell Burt Microsoft Excel Worksheet Functions 1 4th May 2005 02:46 PM
Clearing Cell Contents Lester Microsoft Excel Programming 2 18th Jun 2004 10:31 PM
Clearing Cell Contents Lee Microsoft Excel Programming 2 11th Feb 2004 10:23 PM


Features
 

Advertising
 

Newsgroups
 


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