you cannot assign more than one value to ka, which is what your code is trying to do.
What do you want to do?
As Boller says that code is trying to assign multiple values, which are coming from the range that's the result of the Intersect.
If you actually want multiple values then if you remove the type part (As Long) of the declaration the code won't error.
However you'll end up with an array of values.
Why do i get run time error on this line? i have a variable as long so i should not be getting overflow
Dim ka As Long
With Worksheets("Sheet1")
ka = Intersect(.UsedRange, .Range("A5:P5000"))
End With
Dim ka As Range
With Worksheets("Sheet1")
Set ka = Intersect(.UsedRange, .Range("A5:P5000"))
End With