PDA

View Full Version : Solved: Code From excel-97 To Excel 2003...



Wolfgang
12-07-2005, 07:17 AM
hi experts...

the h-c has struck again:

he dug out some code which was developed using e-97 and he wants to run it on his e-2003 machine, which of course, failed...

i have no clue what-so-ever about the error message...

would you kindly have a look at this, please:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim criterium As String
On Error GoTo ErrorHandler
criterium = Target.Name.Name
Select Case criterium
Case "$A$30:$B$30"
If IsEmpty(Target.Value(1, 1)) Then Target.Formula = "=TODAY()"
End Select
Exit Sub
ErrorHandler:
criterium = Target.Address
Resume Next
End Sub

thank you very much..

best,
wolfgang

xld
12-07-2005, 07:45 AM
I have no idea what the logic behind this line

criterium = Target.Name.Name

is supposed to be, and you don't say what the problem is. Do you change 2 cells at once as the code tests for? Is the error regarding trusting macro access, if so, you need to "approve" to perform VBA manipulation of VBProject objects.

To set this,
choose Tools/Macro/Security from the Excel menu,
select the Trusted Sources tab
put a check in the checkbox called "Trust Access to Visual Basic Project".

Wolfgang
12-07-2005, 07:55 AM
hi xld...

i conveyed exactly what you said to him and he's kind of embarrassed, meaning, he has no clue about the purpose of this thingy...

mabe someone just played a practical joke on him...

anyway, thank you very much for you time and considerations...

best,
wolfgang