Sub TotalDataMergedCells()
Dim shtData As Worksheet, shtOut As Worksheet
Dim rngData As Range, arrData As Variant, arrOut() As Variant
Dim rngOut As Range
Dim lrowData As Long, firstrowData As Long, rowOut As Long, i As Long
Dim totcolData As Long
Set shtData = ActiveSheet
Set shtOut = Worksheets("Sheet2") ' <--- Change sheet name to the name of your output sheet
Set rngOut = shtOut.Range("A1") ' <--- Change this to where you want it on the sheet
With shtData
totcolData = .Columns("H").Column ' <--- Change to your Royalty Total column
firstrowData = 30 ' <--- This needs to be the row where your data starts
lrowData = .Range("B" & Rows.Count).End(xlUp).Row
Set rngData = .Range(.Cells(firstrowData, "B"), .Cells(lrowData, totcolData))
End With
' Get values
arrData = rngData.Value
ReDim arrOut(1 To UBound(arrData, 1), 1 To 2)
totcolData = totcolData - shtData.Columns("B").Column + 1
For i = 1 To UBound(arrData)
If arrData(i, 1) <> "" Then
rowOut = rowOut + 1
arrOut(rowOut, 1) = arrData(i, 1)
arrOut(rowOut, 2) = arrData(i, totcolData)
End If
Next i
rngOut.Resize(, 2) = Array("Author", "Royalty Total") ' Add Headings
rngOut.Offset(1).Resize(rowOut, 2).Value = arrOut ' Output Data
End Sub