Macro enable shared file mystery

WIGG77

New Member
Joined
Jun 25, 2014
Messages
49
Just a quickie. I know there's a million threads on shared files and they're generally frowned upon as being unreliable.

I use one at work with multiple users and it's relatively stable.
I have a lot of VB in it and all works perfectly when shared.

Just added the following and it works perfectly when unshared but not when shared.
Does anyone know why or if there another solution?

You basically select a cell, message box asks a few question, copies some info to another sheet and deletes the line from the original.
Nothing complicated.

Thanks
Dave

VBA Code:
Sub INVOICE()

Dim ANS As Range
Dim lastRow As Long
Dim AnswerYes As String
Dim AnswerNo As String
   
On Error GoTo CANCELED
Set ANS = Application.InputBox("Which Chair do you wish to report as shipped/invoiced?" & vbNewLine & "Please select chair serial number ", "Shipped/Invoiced", Type:=8)
If MsgBox("You are about to report " & ANS & " as shipped/invoiced. Are you sure?", vbYesNo) = vbNo Then Exit Sub

AnswerYes = MsgBox("Has this chair left the building or will be leaving today?" & vbNewLine & vbNewLine & "Select YES if the chair has been or is being despatched today." & vbNewLine
& vbNewLine & "Select NO if Ex-Works and is not being collected today.", vbQuestion + vbYesNo, "EX-WORKS CHECK")

 If AnswerYes = vbYes Then
 ActiveSheet.Range(ANS.Offset(, 0), ANS.Offset(, 17)).Select
Selection.Copy
   Sheets("SHIPPED").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
lastRow = Sheets("SHIPPED").Range("A" & Rows.Count).End(xlUp).Row
ActiveSheet.Range(ANS.Offset(0, -1), ANS.Offset(0, 17)).Delete xlShiftUp
Sheets("SHIPPED").Range("R" & lastRow).Value = Date
Sheets("SHIPPED").Range("R" & lastRow).Format = "dd/mm/yy"

 Else
 
 ActiveSheet.Range(ANS.Offset(, 0), ANS.Offset(, 17)).Select
Selection.Copy
   Sheets("SHIPPED").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
lastRow = Sheets("SHIPPED").Range("A" & Rows.Count).End(xlUp).Row
ActiveSheet.Range(ANS.Offset(0, -1), ANS.Offset(0, 17)).Delete xlShiftUp

 End If
Sheets("FINISHED").Select
Range("A1").Select

CANCELED:

End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
You cannot insert or delete blocks of cells in a shared workbook.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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