Hi all


Hope, that here is somebone who could help me. I have macro, which will merge and split compiled data into more sheets based on column A. This is working.
However, I would liek to make small correction in the macro, that will paste those split into column Q. at the moment it past to column A.

I've tried to change all the references, but it's not working

Thanks,
Andy

Set ws = wshALL_Merged
lr = ws.Cells(ws.Rows.Count, vcol).End(xlUp).Row
title = "A1:P1"
titlerow = ws.Range(title).Cells(1).Row
icol = ws.Columns.Count
ws.Cells(1, icol) = "Unique"

For i = 2 To lr
    On Error Resume Next
    If ws.Cells(i, vcol) <> "" And Application.WorksheetFunction.Match(ws.Cells(i, vcol), ws.Columns(icol), 0) = 0 Then
    ws.Cells(ws.Rows.Count, icol).End(xlUp).Offset(1) = ws.Cells(i, vcol)
    End If
Next

myarr = Application.WorksheetFunction.Transpose(ws.Columns(icol).SpecialCells(xlCellTypeConstants))
ws.Columns(icol).Clear

For i = 2 To UBound(myarr)
ws.Range(title).AutoFilter field:=vcol, Criteria1:=myarr(i) & ""
If Not Evaluate("=ISREF('" & myarr(i) & "'!A1)") Then
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = myarr(i) & ""
Else

Sheets(myarr(i) & "").Move after:=Worksheets(Worksheets.Count)
End If
ws.Range("A" & titlerow & ":A" & lr).EntireRow.Copy Sheets(myarr(i) & "").Range("A1")
Sheets(myarr(i) & "").Columns.AutoFit
Next

ws.AutoFilterMode = False
ShtHome.Activate
    MsgBox ("Files merged successfully.")
    
    Application.DisplayAlerts = False
    Application.DisplayAlerts = True
    
ExitHandler:
    Application.ScreenUpdating = True