I am not very experienced in programming excel but using some books and examples from internet I can create what I need. Unfortunately I've met problem that I can't resolve. Below you can see the little portion of code (not mine taken from the book ) but for me it doesn't work. when I call function it popup with an error as in the topic.
Anyone can help me with this issue? It is part of the program I would like to update range in one of workbook.names used in selection.validation. Range will be taken diferent file without opening it.
-----------------------------------------------------------------
Sub test() dim l as variant l = LastInColumn(A1) End Sub Function LastInColumn(rngInput As Range) As Variant Dim WorkRange As Range Dim i As Integer Dim CellsQuantity As Integer Application.Volatile Set WorkRange = rngInput.Columns(1).EntireColumn Set WorkRange = Intersect(WorkRange.Parent.UsedRange, WorkRange) CellsQuantity = WorkRange.Count For i = CellsQuantity To 1 Step -1 If Not IsEmpty(WorkRange(i)) Then LastInColumn = WorkRange(i).Value Exit Function End If Next i End Function
Bookmarks