ReinhardtSteyn
New Member
- Joined
- Mar 22, 2021
- Messages
- 7
- Office Version
- 365
- Platform
- Windows
Good Day
I created a test spreadsheet in order to test coding to determine if spreadsheet name exists. The following coding was used:
Following results was returned which is correct.
When I apply this same coding to the spreadsheet intendent to following results are returned:
I'm not sure why this is happening. When I use the F8 in the VBA to perform the run by line to check the coding, I noted that the function is not triggered. The function is perfectly triggered in my test spreadsheet.
The intendent spreadsheet is saved in ".xlsb" format. Even tried saving the spreadsheet in a micro enabled format, but still the function is not triggered.
Help will be much appreciated
I created a test spreadsheet in order to test coding to determine if spreadsheet name exists. The following coding was used:
VBA Code:
'Inputs:
'WhatSheet - String Name of Sheet (ex "Sheet1")
' WhatRange (Optional, Default = "A1") - String Name of Range (ex "A1")
Function RangeExists(WhatSheet As String, Optional ByVal WhatRange As String = "A1") As Boolean
'WhatSheet = ActiveWorkbook.Sheets("SHEET5").Range("a" & i1)
Dim test As Range
On Error Resume Next
Set test = ActiveWorkbook.Sheets(WhatSheet).Range(WhatRange)
RangeExists = Err.Number = 0
On Error GoTo 0
End Function
Sub CheckSheetexists()
Dim i1 As Integer
Dim WhatSheet As String
For i1 = 7 To 12
WhatSheet = ActiveWorkbook.Sheets("SHEET5").Range("E" & i1)
ActiveWorkbook.Sheets("SHEET5").Range("F" & i1).Formula = "=RangeExists(E" & i1 & ")"
Next i1
End Sub
Following results was returned which is correct.
When I apply this same coding to the spreadsheet intendent to following results are returned:
I'm not sure why this is happening. When I use the F8 in the VBA to perform the run by line to check the coding, I noted that the function is not triggered. The function is perfectly triggered in my test spreadsheet.
The intendent spreadsheet is saved in ".xlsb" format. Even tried saving the spreadsheet in a micro enabled format, but still the function is not triggered.
Help will be much appreciated
Last edited by a moderator: