Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Clearing cell contents

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Clearing cell contents

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Clearing cell contents

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
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
Clearing cell contents Gina Excel Programming 2 May 4th 06 09:50 AM
Clearing cell contents on CellUpdate loopoo Excel Programming 1 November 14th 05 01:16 PM
Clearing Contents of Cell Burt Excel Worksheet Functions 1 May 4th 05 02:46 PM
Clearing Cell Contents Lester Excel Programming 2 June 18th 04 10:31 PM
Clearing Cell Contents Lee Excel Programming 2 February 11th 04 10:23 PM


All times are GMT +1. The time now is 12:19 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"