Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default If cancel list box don't enter FALSE in list

This works okay, except if you cancel out of entering something in the list, it enters FALSE. Don't want that.

Thanks,
Howard

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1")) Is Nothing Then Exit Sub

Dim strName As String

If Target = "Not on list" Then
strName = Application.InputBox("Add To List", _
"Add to list here", "Enter Whatever", , , , , 2)
Range("F1").End(xlDown).Offset(1, 0).EntireRow.Insert
Range("F1").End(xlDown).Offset(1, 0) = strName
End If

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default If cancel list box don't enter FALSE in list

Hi Howard,

Am Wed, 28 Aug 2013 07:45:46 -0700 (PDT) schrieb Howard:

This works okay, except if you cancel out of entering something in the list, it enters FALSE. Don't want that.


try:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$B$1" Then Exit Sub

Dim strName As String

If Target = "Not on list" Then
strName = Application.InputBox("Add To List", _
"Add to list here", "Enter Whatever", , , , , 2)
If strName = "" Or strName = "False" Then Exit Sub
Range("F1").End(xlDown).Offset(1, 0).EntireRow.Insert
Range("F1").End(xlDown).Offset(1, 0) = strName
End If

End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default If cancel list box don't enter FALSE in list

On Wednesday, August 28, 2013 8:33:53 AM UTC-7, Claus Busch wrote:
Hi Howard,



Am Wed, 28 Aug 2013 07:45:46 -0700 (PDT) schrieb Howard:



This works okay, except if you cancel out of entering something in the list, it enters FALSE. Don't want that.




try:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address < "$B$1" Then Exit Sub



Dim strName As String



If Target = "Not on list" Then

strName = Application.InputBox("Add To List", _

"Add to list here", "Enter Whatever", , , , , 2)

If strName = "" Or strName = "False" Then Exit Sub

Range("F1").End(xlDown).Offset(1, 0).EntireRow.Insert

Range("F1").End(xlDown).Offset(1, 0) = strName

End If



End Sub





Regards

Claus B.


Nice little one line fix.
Thanks, Claus
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
IF statement based on True/False that activates a certain list box rittzy Excel Worksheet Functions 1 March 19th 10 06:01 AM
Compare List A to List B, Return List B Items Not in List A zwestbrook Excel Programming 4 September 18th 08 10:32 PM
how to enter simple list and sum John[_4_] New Users to Excel 1 May 16th 07 05:11 AM
data validation list: how do i 'force' a user to enter data from the list? showsomeidnow Excel Discussion (Misc queries) 4 May 1st 07 05:49 PM
data validation list: how do i 'force' a user to enter data from the list? showsomeidnow Excel Discussion (Misc queries) 2 April 29th 07 11:09 PM


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