View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Fredrik Wahlgren Fredrik Wahlgren is offline
external usenet poster
 
Posts: 339
Default Cell validation problem

Hi

I have a function which takes a cell reference as a parameter. The function
is similar to this

Function MyRef(wb As String, ws As String, cell As String)
MyRef = Application.Evaluate("[" + wb + ".xls]" + ws + "!" + cell)
End Function

The idea behind this function is simple. Instead of entering something like
this:

=[SomeSheet.xls]Sheet1!A1

I can now do this:

=MyRef("SomeSheet","Sheet1","A1")

How can I validate the last parameter? "A1" is a valid cell reference while
"XX23" isn't.
I want to to show a custom error messsage in this case.

TIA,
Fredrik