Hi guys looking for some help here. I have 3 workbooks that form an ordering system for my work canteen. Workbook one is opened by the end user at their workstation. they see todays menu and can select what they would like for lunch. Their slection is placed on a list at the side of the page. once they have entered their name and payroll number they click the submit button. This should pass their details and selection to the next workbook which is sitting open in the kitchen. The Kitchen workbook has 2 parts, the first is simply todays menu that is updated every mornong by the chef. When he updates his page the menu in the first book automatically updates. The second part of this workbook is the order list. Once he has made the order he selects it in the list and the details are then passed to the third workbook which is open at the canteen counter. Once the employee shows up to collect their meal the counter staff simply flag the order as collected.
Ok the problem i am having is that everything works as it should is all workbooks are open on the same pc but when I have them open on seperate machines( even though the actual files are all in the same directory) and click the submit button i get runtime error #9 subscript out of range, i have clicked the debug option and it is pointing to the workbook i am trying to send the data too. I have added the code that makes up m to let you see how i have it set up. Hope someone can help as I am struggling with this. Am I missing something. Do I have to declare something as am trying to update an external source.
//Public Sub Submit()
Dim Ws1 As Worksheet, Ws2 As Worksheet
Dim StartRow As Integer
Dim cellrange As Range
'source file
Set Ws1 = Workbooks("Front End.xls").Sheets("Sheet1")
'destination file
Set Ws2 = Workbooks("Kitchen.xls").Sheets("Sheet2")
StartRow = 12
'checks if name has been entered
If Range("A2") = Empty Then
MsgBox "Please Enter Your Name", vbOKOnly
Exit Sub
End If
'checks if payroll nuber has been entered
If Range("B2") = Empty Then
MsgBox "Please Enter Your Payroll Number", vbOKOnly
Exit Sub
End If
'checks that user has selected an item
If Range("A5") = Empty Then
MsgBox "You Have Not made a Selection", vbOKOnly
Exit Sub
End If
'checks the selection list in the Kitchen for an empty line and adds users choices
For Each cellrange In Ws2.Range("A12:A34")
If cellrange.Value = Empty Then
Ws2.Range("A" & StartRow) = Ws1.Range("A2")
Ws2.Range("B" & StartRow) = Ws1.Range("B2")
Ws2.Range("C" & StartRow) = Ws1.Range("A5")
Ws2.Range("D" & StartRow) = Ws1.Range("A6")
Ws2.Range("E" & StartRow) = Ws1.Range("A7")
Ws2.Range("F" & StartRow) = Ws1.Range("A8")
Ws2.Range("G" & StartRow) = Ws1.Range("A9")
Ws2.Range("H" & StartRow) = Ws1.Range("A10")
Exit Sub
End If
StartRow = StartRow + 1
Next cellrange
End Sub//
Bookmarks