I am trying to developp a small tool in vba and as I am a beginner in this, I am having some trouble.
I would like to apply on specific cells of a column a treatment. This is my actual code :
For Each C In ActiveSheet.UsedRange.Columns("B").Cells
The problem with this code, is that is applying to all the cells of my column B, whereas I would like to stop at a specific line (line which I am getting for another function (GetLine) that I have developped) :
Function GetLine(rw As Long) As Long
GetNextEmptyCell = //my code
End Function
So I would like to know how to specify in my foreach to stop at the number returned by my function.
thanks in advance for your help
你可以使用这样的东西从第1行循环到指定的行:
For Each C In ActiveSheet.Range("B1:B" & GetLine).Cells
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.