Is Value in closed workbook

Nimbo1842

New member
Local time
Today, 19:14
Joined
Mar 17, 2013
Messages
8
I have been searching for a while but I can't find exactly what i'm looking for.

Basically I have workbook which consists of valid post codes for the area (lets call it Postcode.xls). It is a large file and I am reluctant to open it due to network speed.

I have a form run through another workbook which has a number of inputs one of which is the text box for PostCode. If the Post code workbook is open then I have produced a function to return a true or false value if the value in the text box matches a post code in the workbook.

Is there a way of replicating this but having the Post code workbook closed???
 
The inputs wbk has to read the postcode wbk and I doubt it will be possible to do that without fetching it.
Is there space on the drive where the input wbk sits to also contain a copy of the postcode wbk? Postcode data changes infrequently so keeping different copies in sync is not going to be too burdensome.
 
Sorry mate bit confused, I have the below code to check if the post code is valid

Validcode = IsPostcodeValid(PostCode.Value)
If Validcode = False And Validate = True Then
Message3.initialise "This is not a valid Leicestershire post code!", "Ok"
Message3.Show
'MsgBox "This is not a valid Leicestershire post code"
End If
End If

Public Function IsPostcodeValid(ByRef PostCode As String) As Boolean
'On Error GoTo ErrIsPostcodeValid
Set ws = Worksheets("Options")
IsPostcodeValid = False
'Checks the postcode is a valid length
If Len(PostCode) < 6 Or Len(PostCode) > 8 Then
Exit Function
End If
'Changes the postcode to upper case to make checking using like easier
PostCode = UCase(PostCode)
'Working Version
If Not IsError(Application.Match(PostCode, Workbooks(ws.Cells(2, 6).Value).Worksheets("postcode").Range("A:A"), 0)) Then
IsPostcodeValid = True
Exit Function
End If
End Function

Basically i'm trying to replicate that but have the workbook which contains the postcode worksheet closed, if that makes sense?
 
It does make sense. I was really suggesting dodging the issue of network speed by making local copes of the postcodes workbook and opening them.
 

Users who are viewing this thread

Back
Top Bottom