F
Felipe Montoya
I have created a macro function to reference tha last cell used in a column
and returns the data in it to another cell in the sheet. It works fine for
just one sheet within the same workbook. But if I use the function in
another sheet, it returns the value from the previous sheet.
Can anybody help me solve it so that I can get the value that correspond to
each sheet. Below is the code I am using
Function UltimaFecha(Fecha As Date, celda As String) As Date
Application.Volatile
Fecha = Cells(Cells.Rows.Count, celda).End(xlUp).Value
UltimaFecha = Fecha
End Function
and returns the data in it to another cell in the sheet. It works fine for
just one sheet within the same workbook. But if I use the function in
another sheet, it returns the value from the previous sheet.
Can anybody help me solve it so that I can get the value that correspond to
each sheet. Below is the code I am using
Function UltimaFecha(Fecha As Date, celda As String) As Date
Application.Volatile
Fecha = Cells(Cells.Rows.Count, celda).End(xlUp).Value
UltimaFecha = Fecha
End Function