vba code doesn't work from computer to computer

CQuirin

New Member
Joined
Jul 31, 2007
Messages
1
Hi,
I have a workbook that has 5 worksheets. Each sheet represents the days of the week. The problem is the code works in my workbook but not on others. It only populates the project name not the project number. The result wanted is for the user to select from the project name form the list on charge nums sheet and populate the project number at the same time for each day of the week. Excel fills in project name and project number in two different columns. The cells are lock to keep the user from entering data. The versions of excel are the same. Help if you can. Thanks

Each has the following code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim wsChargeNums As Worksheet
Dim ProjectListRow As Long
Dim ProjectNoRow As Long

On Error GoTo errHandler
Set wsChargeNums = Worksheets("Charge Nums")

If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False

Select Case Target.Column
Case 2
With Target
If .Value = "" Then
.Offset(0, 1).Value = ""
Else
ProjectListRow = Application.Match(.Value, wsChargeNums.Range("ProjectList"), 0)
.Offset(0, 1).Value = wsChargeNums.Range("ProjectNo")(ProjectNoRow).Value
End If
End With
Case 3
With Target
If .Value = "" Then
.Offset(0, -1).Value = ""
Else
ProjectListRow = Application.Match(.Value, wsChargeNums.Range("ProjectList"), 0)
.Offset(0, -1).Value = wsChargeNums.Range("ProjectNo")(ProjectListRow).Value
End If
End With
Case Else
'do nothing
End Select

exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
MsgBox Err.Number & ": " & Err.Description
GoTo exitHandler

End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Is it just different workbooks or different computers that is the issue. You may need to check the references if it is different machines. To do this go into the VBE and select the tools menu choosing references. Compare this to your references and make sure all this is checked in your references is checked in theirs.
 
Upvote 0
Looks like your code uses several Named Ranges, do those exist on the other PC's?
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,369
Members
449,080
Latest member
Armadillos

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