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
 

Some videos you may like

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

brian.wethington

Well-known Member
Joined
Jul 20, 2006
Messages
1,739
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.
 

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
Looks like your code uses several Named Ranges, do those exist on the other PC's?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,511
Messages
5,596,576
Members
414,079
Latest member
Frills

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