View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
okrob okrob is offline
external usenet poster
 
Posts: 142
Default Delete the contents of a cell under multiple conditions

Try this:
Public Sub test()
Dim Cvalue As Double
Cvalue = Range("A1").Value
On Error GoTo test_Error
Select Case Cvalue
Case 1
Range("B1").ClearContents
Case 2
Range("B1").Value = Application.InputBox("Input value for
B1")
Case 3
Range("B1").ClearContents
Case 4
Range("B1").Value = Application.InputBox("Input value for
B1")
Case Else
Exit Sub
End Select
On Error GoTo 0
Exit Sub

test_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure test of Module Module1"
End Sub


Rob




wrote:
If cell A1=1, A1=3 or A1=5, I want the existing contents of B1 to be
deleted. However, if A1=2 or A1=4, I want to be able to enter input
into B1. Can someone suggest a macro for this? Thanks.

Michael