What LASTCELL does is return the last cell of a given range... no matter where, and it returns that as a reference, that's why we can use ROW() or COLUMN() to find the "actual" address of it.
I created this Index sheet, and I had to make a couple of small modifications to the code for it to work:
The formula in B2 is:
=HYPERLINK("[LastCell.xls]"&ADDRESS(ROW(LASTCELL(INDIRECT("'"&A2&"'!$1:$65536"),1)),COLUMN(LASTCELL(INDIRECT("'"&A2&"'!$1:$65536"),1)),4,,A2))
And the code is:<font face=Courier New><SPAN style="color:#00007F">Function</SPAN> LASTCELL(<SPAN style="color:#00007F">Optional</SPAN> Rng<SPAN style="color:#00007F">As</SPAN> Range,<SPAN style="color:#00007F">Optional</SPAN> Volatile<SPAN style="color:#00007F">As</SPAN><SPAN style="color:#00007F">Boolean</SPAN>)<SPAN style="color:#00007F">As</SPAN> Range
<SPAN style="color:#00007F">Dim</SPAN> WS<SPAN style="color:#00007F">As</SPAN> Worksheet, lRow<SPAN style="color:#00007F">As</SPAN><SPAN style="color:#00007F">Long</SPAN>, lCol<SPAN style="color:#00007F">As</SPAN><SPAN style="color:#00007F">Long</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> CRow<SPAN style="color:#00007F">As</SPAN><SPAN style="color:#00007F">Long</SPAN>, CCol<SPAN style="color:#00007F">As</SPAN><SPAN style="color:#00007F">Long</SPAN>
Application.Volatile Volatile
<SPAN style="color:#00007F">If</SPAN> Rng<SPAN style="color:#00007F">Is</SPAN><SPAN style="color:#00007F">Nothing</SPAN><SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#00007F">Set</SPAN> Rng = Application.Caller.Parent.Cells
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">On</SPAN><SPAN style="color:#00007F">Error</SPAN><SPAN style="color:#00007F">GoTo</SPAN> exiting
<SPAN style="color:#00007F">With</SPAN> Intersect(Rng, Rng.Parent.UsedRange)
lRow = .Rows.Count
lCol = .Columns.Count
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">With</SPAN>
<SPAN style="color:#00007F">Set</SPAN> Rng = Intersect(Rng, Rng.Parent.UsedRange)
<SPAN style="color:#00007F">Do</SPAN>
<SPAN style="color:#00007F">With</SPAN> Rng.Cells(lRow, Rng.Columns.Count)
<SPAN style="color:#00007F">If</SPAN> Len(.Formula) > 0<SPAN style="color:#00007F">Then</SPAN>
CRow = .Column
<SPAN style="color:#00007F">Else</SPAN>
CRow = .End(xlToLeft).Column
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">With</SPAN>
<SPAN style="color:#00007F">If</SPAN> CRow< Rng.Column<SPAN style="color:#00007F">Then</SPAN> CRow = 1
<SPAN style="color:#00007F">If</SPAN> CRow = 1 And Len(Rng.Cells(lRow, CRow).Formula) > 0<SPAN style="color:#00007F">Then</SPAN>
CRow = 0
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">With</SPAN> Rng.Cells(Rng.Rows.Count, lCol)
<SPAN style="color:#00007F">If</SPAN> Len(.Formula) > 0<SPAN style="color:#00007F">Then</SPAN>
CCol = .Row
<SPAN style="color:#00007F">Else</SPAN>
CCol = .End(xlUp).Row
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">With</SPAN>
<SPAN style="color:#00007F">If</SPAN> CCol< Rng.Row<SPAN style="color:#00007F">Then</SPAN> CCol = 1
<SPAN style="color:#00007F">If</SPAN> CCol = 1 And Len(Rng.Cells(CCol, lCol).Formula) > 0<SPAN style="color:#00007F">Then</SPAN>
CCol = 0
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">If</SPAN> CRow = 1<SPAN style="color:#00007F">Then</SPAN>
lRow = lRow - 1
<SPAN style="color:#00007F">ElseIf</SPAN> CCol = 1<SPAN style="color:#00007F">Then</SPAN>
lCol = lCol - 1
<SPAN style="color:#00007F">Else</SPAN>
<SPAN style="color:#00007F">Exit</SPAN><SPAN style="color:#00007F">Do</SPAN>
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">Loop</SPAN>
exiting:
<SPAN style="color:#00007F">If</SPAN> lRow = 0<SPAN style="color:#00007F">Then</SPAN> lRow = 1
<SPAN style="color:#00007F">If</SPAN> lCol = 0<SPAN style="color:#00007F">Then</SPAN> lCol = 1
<SPAN style="color:#00007F">Set</SPAN> LASTCELL = Rng.Cells(lRow, lCol)<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">Function</SPAN></FONT>
My sheets are named Hoja1, Hoja2 and Hoja3, but you could extend this to all the sheets that you want.