estut
Gebruiker
- Lid geworden
- 5 mrt 2008
- Berichten
- 52
- Besturingssysteem
- MacOS Sonoma 14.16.1
- Office versie
- Excel for Mac 2019 en Google Sheets voor XLookup gebruik
Dankzij Roncancio is het splitsen van cellen prima gelukt. Door tussenvoegsels in de namen ontstaan er verschillende kolommen. De gegevens in de laatste kolom heb ik alleen nodig (ID-codes). Vraag nu is of er een functie toegepast kan worden die de inhouden van die laatste cellen netjes in 1 kolom plaatst. Op het internet kwam ik er code voor tegen, maar die lijkt mij complex. Zie onder:
Dank vast voor reactie..
Function LastCell(ws As Worksheet) As Range
Dim LastRow&, LastCol%
' Error-handling is here in case there is not any
' data in the worksheet
On Error Resume Next
With ws
' Find the last real row
LastRow& = .Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
' Find the last real column
LastCol% = .Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
End With
' Finally, initialize a Range object variable for
' the last populated row.
Set LastCell = ws.Cells(LastRow&, LastCol%)
End Function
Dank vast voor reactie..
Function LastCell(ws As Worksheet) As Range
Dim LastRow&, LastCol%
' Error-handling is here in case there is not any
' data in the worksheet
On Error Resume Next
With ws
' Find the last real row
LastRow& = .Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
' Find the last real column
LastCol% = .Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
End With
' Finally, initialize a Range object variable for
' the last populated row.
Set LastCell = ws.Cells(LastRow&, LastCol%)
End Function