Code:
[COLOR=#333333]Function isThisAValidSheet () as Boolean[/COLOR]
[COLOR=#333333]isThisAValidSheet = True[/COLOR]
[COLOR=#333333]End Function[/COLOR]
That function always returns TRUE. If you wanted to put true in a cell, you could simply do that =TRUE
Does it serve a purpose. Are you using that cell to determine if other cells have valid data?
If wkSheet.range("isThisAValidSheet").value = TRUE then '(you would have to give it a named range for this to work)
'export worksheet
'do other stuff
End If
or
Thank you yet again for your response.
This function is just one of the many in a sheet which returns similar value. Heres a brief description of what I am trying to achieve here;
Each worksheet has this and other functions. The function in the main module calls this and other such functions to query what kind of information is contained in this sheet. For example;
Worksheets with variables and no tables will have the following (for example in one of the sheets called CWdashboard:
function isHaveVariables() as boolean
isHaveVariable = True
end function
function isHaveTables() as boolean
isHaveTables = False
end function
Worksheets with tables but no variables will have the following (for example is one of the sheets called CWcargoPlanner):
function isHaveVariables() as boolean
isHaveVariable = False
end function
function isHaveTables() as boolean
isHaveTables = True
end function
Worksheets with tables and variables will have the following:
function isHaveVariables() as boolean
isHaveVariable = True
end function
function isHaveTables() as boolean
isHaveTables = True
end function
And so on...
And there are other 'properties' that are also being checked. After the function calling the module knows whether variables or tables exist, it then tries to extract values from variables declared in the worksheet depending on the type of information contained in the worksheet as determined by the isHaveTables and isHaveVariables.
The names of some of the sheets that need to be checked are CWdashboard, CWcargoPlanner etc. If I use the following statement;
doVariablesExistInThisSheet = CWdashboard.isHaveVariables, (which in this case will return true) then the appropriate procedure is called to extract the value of the required variable from that sheet.
Similarly, doVariablesExistInThisSheet = CWcargoPlanner.isHaveVariables will return false, and the procedure call will not be initiated.
Since there are numerous sheets, and the number of sheets will keep changing, I would like to just cycle thru all the sheets and check for these functions in those sheets so that the proper procedure may be called to extract the required variables.
Unfortunately, which I use the originally posted code which declares wkSheet as a worksheet object, and then tries to call .isHaveVariable for each of these objects, I immediately get a compile error. I understand that the compiler is not aware whether this function exists in the sheet contained in the object wkSheet. And hence, I am looking for a workaround. I hope that I have been able to express the problem in an understandable manner.
Many thanks all the same.