Split func - "Sub or function is not defined": Wtf!?

the1nk

New Member
Joined
Mar 31, 2008
Messages
16
Hey all.
I'm doing some VBA in Excel 2003 (11.81) it works great. However, when I send the workbook (including the macro) to a customer, she gets a compile error "Sub or function not defined" and highlights "Split" with its parameters. She's using Excel 2003 (11.5). Any ideas what could be causing that ?

Code:
Sub CountStores()
'Original Code by the masterful Bob Shenker
'Modified code by Adam Davis
'Setup the sheets..
Dim shtData As Worksheet
Dim shtSumm As Worksheet
'Setup the ranges..
Dim rngStores As Range
Dim rngSearching As Range
Dim srng As Range
Dim drng As Range
Dim dsrng As Range
'And Misc Variables..
Dim I As Integer
Dim iC As Integer
Dim strNames() As String
Dim iCol As Integer

Set shtData = ActiveWorkbook.Worksheets("Data")
Set shtSumm = ActiveWorkbook.Worksheets("Summary")

Set rngStores = shtSumm.Range("B4", shtSumm.Range("B65536").End(xlUp).Address)
For iCol = 1 To 16
    Set rngSearching = shtData.Range(Chr(72 + iCol) & "2", shtData.Range(Chr(72 + iCol) & "65536").End(xlUp).Address)
    For Each srng In rngStores
        strNames() = Split(srng.Value, ";")
        For Each dsrng In rngSearching
            For iC = LBound(strNames) To UBound(strNames)
                If (InStr(1, dsrng.Value, strNames(iC), vbTextCompare)) Then
                    I = I + 1
                End If
                'DoEvents
            Next iC
            DoEvents
        Next dsrng
        srng.Offset(0, iCol).Value = I
        I = 0
        DoEvents
    Next srng
    DoEvents
Next iCol
End Sub
 
Last edited:

Some videos you may like

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Hi

try prefixing the Split function with VBA:

Code:
strNames() = VBA.Split(srng.Value, ";")

and see if the customer continues to suffer from this problem.
</pre>
 

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
the1nk<SCRIPT type=text/javascript> vbmenu_register("postmenu_1633788", true); </SCRIPT>

Ask her if her Excel has unneeded object libraly reference(s).
It sometime cause the problem with the functions.
 

the1nk

New Member
Joined
Mar 31, 2008
Messages
16
unneeded library references?

The customer, unfortunately, isn't a coder. :p So, therefore, the VBA settings (and references, I would imagine) should all be standard. I, too, have the standard references on, and no special ones on. :-\ So, I don't think it's that. But maybe she has missing references? I don't know how that would happen though. x_X

Thanks. ;)
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,218
Office Version
  1. 365
Platform
  1. Windows
Ask the user to check under Tools>References... in the VBA editor.

Shouldn't be too difficult and they might actually find some references marked as MISSING.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,499
Messages
5,596,517
Members
414,074
Latest member
Matthew Kakde

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top