May 09 2022 06:28 PM
Hello,
I had actually created another topic for this issue then thought it was fixed. However, turns out it's not.
The code below doesn't work first time the workbook is opened. If I close it and re-open it works. How can I fix this?
Sub CopyRAWMMP()
Application.DisplayAlerts = False
Dim Ct As Long
For Each wb In Application.Workbooks
If Trim(LCase(wb.Name)) Like "data-*" Then
Ct = Ct + 1
wb.Activate
Exit For
End If
Next wb
If Ct = 0 Then
MsgBox "MSG"
Exit Sub
End If
Range("A2:N2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Application.CutCopyMode = False
Selection.Copy
Workbooks("Real Time.xlsm").Activate
Worksheets("Raw MMP").Activate
Range("RawMMP[Date]").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Application.DisplayAlerts = True
End Sub
Immediate window doesn't recognize that the workbook is opened. I was advised that the workbook is opening in a different instance. But I don't even know what that means.
I'd really appreciate your help.
May 10 2022 06:09 AM
May 15 2022 06:20 PM