View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Why won't this simple VBA script work in excel 2002?

See response in programming.

--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)

"Calle" wrote in message
...
I made a script with help from members on this forum in excel 2003. Now I
sent it to my boss and it doesnt work on his machine. I have also tried it
now on excel 2002 and it won't work.

What am I doing wrong? I get an error message that it can't compile and

that
it can't find project or library...
Script:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRng As Range

Set myRng = Me.Range("I16,I19,E27,G24")

With Target
If .Cells.Count 1 Then Exit Sub
If Intersect(.Cells, myRng) Is Nothing Then Exit Sub
If .Value = "" Then Exit Sub

Select Case LCase(.Address(0, 0))
Case Is = "i16"
If LCase(.Value) = LCase("klicka här fär utrustning") Then
'skipit
Else
If LCase(.Value) = LCase("rensa val") Then
Selection.Offset(1, -2).ClearContents
Selection.Offset(0, 0).ClearContents
Else
Application.EnableEvents = False
Me.Range("G17").Value = Me.Range("G17").Value & .Value
.ClearContents
Application.EnableEvents = True
End If
End If
Case Is = "i19"
If LCase(.Value) = LCase("klicka här fär utrustning") Then
Else
If LCase(.Value) = LCase("rensa val") Then
Selection.Offset(1, -2).ClearContents
Selection.Offset(0, 0).ClearContents
Else
Application.EnableEvents = False
Me.Range("G20").Value = Me.Range("G20").Value & .Value
.ClearContents
Application.EnableEvents = True
End If
End If
Case Is = "e27"
If LCase(.Value) = LCase("ej tröskel") Then
Selection.Offset(1, 0).ClearContents
Selection.Offset(2, 0).ClearContents
End If
End Select
End With
End Sub