I have a little problem in VBA, I want to put row and column of Range function in String format like that :
debut = "BH" & LTrim(Str(i))
fin = "DB" & LTrim(Str(i))
For Each Cell In Ws.Range("debut:fin")
But i have an error, how can i resolve it ?
Thanks
The way you have done it ("debut:fin"
), the range is really equal to that string and is invalid. What you need to do is concatenate the 2 strings with a :
in between with the &
operator:
For Each Cell In Ws.Range(debut & ":" & fin)