Vba variable not defined

nd0911

Board Regular
Joined
Jan 1, 2014
Messages
166
Hi there,

I send a file to someone with VBA code, and he get an error that in my 3 PC's I do NOT get.

the error message is :"variable not define

what is worge with his PC

Does anyone familiar this problem

TNX
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Thank you shg, but my code is very organized, all of my varieble's in the code are declared with OPTION EXPLICIT statement's
 
Upvote 0
Are you sure that's the error, and not "Sub or function not defined"?
 
Upvote 0
Can you post the actual code, and tell us which variable is highlighted when the error occurs?

Maybe there are missing references
On the problematic PC, in the VBA window click Tools - References.
Is there anything listed as Missing ?
 
Upvote 0
Thank you Jonmo1

No listed missing (checked)


the code :

Code:
Dim s0 As Worksheet
Dim s1 As Worksheet
Dim s2 As Worksheet
Dim Rng As Range, cl As Range


Set s0 = ThisWorkbook.Sheets("EmployeeSelections")
Set s1 = ThisWorkbook.Sheets("DataBase")
Set s2 = ThisWorkbook.Sheets("Welcome")

Set Rng = s1.Range("a2:a" & s1.Cells(Rows.Count, "a").End(xlUp).Row)


ListBox1.Clear

If s0.Range("a1").Value = "" Then
    ListBox1.Enabled = True
    SubmitWhoAmI.Enabled = True
    
    For Each cl In Rng
        ListBox1.AddItem cl
    Next
    ListBox1.AddItem ""
Else
    Call ListBox2EmpployeeSelections
End If


End Function

the marked line is ListBox1.Clear

and the code is in the Sheet VBE (NOT MODOLE)
 
Last edited:
Upvote 0
are they using a non english setup ?
 
Upvote 0
Or maybe the user deleted the listbox.
 
Upvote 0

Forum statistics

Threads
1,212,927
Messages
6,110,720
Members
448,294
Latest member
jmjmjmjmjmjm

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
Back
Top