Hi all,
I'm trying to create a dynamic range but am failing somehow.
So what I need is to look in row 2 for "Eindtotaal", and then create a range from G2 to the cell where "Eindtotaal" is found.
What am I doing wrong?
Mathijs.
I'm trying to create a dynamic range but am failing somehow.
Code:
Worksheets("data").Activate
Dim Colmn
Colmn = Application.Match("Eindtotaal", Range("2:2"), False)
Dim lastr As Range
Set lastr = ActiveSheet.Cells(2, Colmn)
Dim KGrng
KGrng = Worksheets("data").Range("G2:" & lastr)
So what I need is to look in row 2 for "Eindtotaal", and then create a range from G2 to the cell where "Eindtotaal" is found.
What am I doing wrong?
Mathijs.