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
Thanks in Advance
K
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