LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Select Case problem when hitting the Delete key

Below is my code. Basically, when the user selects "Final Decision in
any of the cells in range g30:g54, a userform pops up and they select
Approved or Denied. This places that in the cell to the right of that
field. The problem is that sometimes this will change from Final
Decision to something else and then I want that Approved or Denied
removed. Using the worksheet change function works great until I hit
"Delete". When I delete the value from g30 I get a Type Mismatch
error. I'm assuming it's looking for a value and there isn't one
there. If the value is deleted, I want the cell to the right to be
cleared.

Any ideas?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Application.ScreenUpdating = False
ActiveWorkbook.Sheets("AppendPermit").Unprotect
Application.EnableEvents = False

' Check cell A30
' If the cell is empty, leave it alone and don't check
If Range("A30") = "" Then
GoTo Fin
End If

' If cell A30 equals anything other than "Maint.", then display an
error
' empty the cell and place the cursor back at that cell
If Range("A30").Value < "Maint." Then
MsgBox ("All permits originate from the Maintenance level.
Please enter 'Maint.'"), vbInformation, "Ruh roh. Wrong value."
Range("A30").Value = "Maint."
Range("A30").Select
GoTo Fin
End If

If Application.Intersect(Target, Range("g30:j54")) Is Nothing Then
GoTo Fin
Else
With Sheets("AppendPermit").Range("g30:j54")
Select Case Target.Value

Case ""
Target.Offset(0, 1).Value = ""

Case "Final Decision"
If Target.Offset(0, 1).Value = "" Then
Decision.Show
Target.Offset(0, 1).Value = Sheets("Lists").Range("Q7")
End If

Case Else
Target.Offset(0, 1).Value = ""
End Select
End With
End If

Fin:
Application.ScreenUpdating = True
ActiveWorkbook.Sheets("AppendPermit").Protect
Application.EnableEvents = True
End Sub
 
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
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Delete Row Select Case Little Penny[_3_] Excel Programming 8 January 21st 08 12:05 AM
Select Case on a range - problem cdb Excel Programming 4 February 11th 05 01:37 PM
Problem With Select Case Steve[_27_] Excel Programming 18 August 6th 03 09:28 PM


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