If isFirstSheet Then
' Chỉ sheet đầu tiên mới ghi cột A-E
With wsTotal
.Cells(totalRowCount, 1).Value = [Link](i, 1).Value ' Name
.Cells(totalRowCount, 2).Value = fullCode ' Code
.Cells(totalRowCount, 3).Value = companyCode ' ID
.Cells(totalRowCount, 4).Value = [Link](i, 3).Value ' Currency
.Cells(totalRowCount, 5).Value = [Link](i, 4).Value ' Year
End With
End If
' Ghi cột giá trị
[Link](totalRowCount, colIndex).Value = [Link](i, 5).Value
totalRowCount = totalRowCount + 1
Next i
' Sau sheet đầu tiên, reset dòng
totalRowCount = 2
colIndex = colIndex + 1
isFirstSheet = False
End If
Next ws
[Link]
[Link] = True
[Link] = True