Destination Workbook opening as read only

L

Legacy 330376

Guest
Hi VBA Geeks,

I have posted this question in another forum, however I thought I try my luck on here as I really require some expert advice.

Please see attached link.

How to avoid destination workbook to open as read-only

I have multiple workbooks which will populate data into a master workbook.
My issue is if users press the macro button simultaneously on there individual workbook, it will perform a read-only dialog box to "save as" the master spreadsheet. Is there a way, I can eliminate this issue? I want the user to be able to have there changes updated in the master spreadsheet, without any errors.

From my understanding, "sharing" a workbook is not recommended with macros.

The code is below

Code:
Private Sub NonC()



Application.ScreenUpdating = False


Dim wb As Workbook, wsDATA As Worksheet, wasOPEN As Boolean
Dim i As Long, LastRow As Long
Set wsDATA = ActiveSheet
LastRow = wsDATA.Range("A" & Rows.Count).End(xlUp).Row



On Error Resume Next
Set wb = Workbooks("MS.xlsm")
On Error GoTo 0

If Not wb Is Nothing Then
    wasOPEN = True
Else
    Set wb = Workbooks.Open("C:\MS.xlsm")
End If

With wsDATA
    For i = 2 To LastRow
        If .Cells(i, "A") = "NON-C" Then
            If .Cells(i, "J") > 15 Or .Cells(i, "O") > 15 Then
                .Range("A" & i).Resize(, 26).Copy
                wb.Sheets("Non Clinical").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial
            End If
        End If
    Next i
    
    If wasOPEN Then
        wb.Save
    Else
        wb.Close True
    End If
    
End With
Application.Wait (Now + TimeValue("0:00:05"))
Application.CutCopyMode = False
End Sub

Thanks in Advance
K
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,222,435
Messages
6,166,019
Members
452,008
Latest member
Customlogoflipflops

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