I have a problem, because when I run the macro I get an error like in the title here:
However, when I go step by step after F8 and go manually to the Adekwatnosc tab, everything is ok. How to fix that the file itself works in the background and goes to the indicated tab.
This is my all code:
VBA Code:
data_wb.Sheets("Adekwatnosc").Rows("1:1").Select
This is my all code:
VBA Code:
Dim vDate As Date
Dim wbMe As Workbook
Dim data_wb As Workbook
Dim ws As Worksheet
Dim inputbx As String
Dim loc As Range, lc As Long
Dim MyFolder As String, ThisMonth As String
Dim MyFile As String
Set wbMe = ActiveWorkbook
With wbMe.Sheets("input_forecast").Rows("1:1")
.Copy
.PasteSpecial Paste:=xlPasteValues
.NumberFormat = "YYYY-MM-DD"
End With
MyFolder = "C:\Users\V1410190\Documents\FOLDERY ROBOCZE"
MyFile = Dir(MyFolder & "\filee*.xlsm")
If MyFile <> "" Then
Set data_wb = Workbooks.Open(MyFolder & "\" & MyFile, UpdateLinks:=0)
Else
Exit Sub
End If
Application.ThisWorkbook.UpdateLinks = xlUpdateLinksNever '2
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.AskToUpdateLinks = False
data_wb.Sheets("Adekwatnosc").Rows("1:1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "YYYY-MM-DD"