A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Jim already pointed you to a great resource. I wanted to point you at a small programming error.
Despite what you might think, in this declaration:
Dim LinhaIniOri, LinhaFinOri, LinhaIniDes, LinhaFinDes As Integer
ONLY the last variable is declared as integer. The other ones are of type Variant.
In VBA you have to add the type definition to each one:
Dim LinhaIniOri As Integer, LinhaFinOri As Integer, LinhaIniDes As Integer, LinhaFinDes As Integer
For readabilities' sake I personally prefer:
Dim LinhaIniOri As Integer
Dim LinhaFinOri As Integer
Dim LinhaIniDes As Integer
Dim LinhaFinDes As Integer