I am relatively new to VBA and I made a macro that has been working on my computer, but when I sent it to someone else, it errors out on this line:
If WorksheetFunction.Concat(ActiveSheet.Range("a2:n2").Value) <> "UnitOper UnitDeptProjectDateLine DescrAmountAccountProductJournal IDLine #RefStatusAffiliate" Then
I will include the entire macro below but I am trying to open a file using getopenfilename and make sure that the file has the correct content. Even when I sent the macro to people using excel 2016, it still doesnt work and errors out.
I tried something new and now it says type mismatch on the same line.
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim myFileName As Variant
Dim sWorkbook, i As String
Dim Macrotool As String
Dim Countlines As Long
Macrotool = ActiveWorkbook.Name
myFileName = Application.GetOpenFilename
If myFileName <> False Then
Workbooks.Open (myFileName)
sWorkbook = ActiveWorkbook.Name
ActiveSheet.Range("O2") = "=concat(a2:n2)"
If ActiveSheet.Range("o2").Value <> "UnitOper UnitDeptProjectDateLine DescrAmountAccountProductJournal IDLine #RefStatusAffiliate" Then
Workbooks(sWorkbook).Close False
i = MsgBox("It looks like you are uploading the wrong file." & vbLf & "Please make sure you are using one of the following queries:" & vbLf & "" & vbLf & "'ACCOUNT_ACTIVITY_ANY_CF'" & vbLf & "'ACCOUNT_ACTIVITY_BU'" & vbLf & "'ACCOUNT_ACTIVITY_BU_OP'" & vbLf & "'ACCOUNT_ACTIVITY_BU_OP_DEP'" & vbLf & "'ACCOUNT_ACTIVITY_BU_OP_DEP_PRJ'", vbOKOnly, "Wrong Filed Used")
Application.ScreenUpdating = True
Workbooks(Macrotool).Activate
Sheets("Home").Select
GoTo OnError
End If