ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   For | Next ...OR... Do | Loop (https://www.excelbanter.com/excel-programming/285766-%7C-next-do-%7C-loop.html)

aapp81[_32_]

For | Next ...OR... Do | Loop
 
i have this code:

Sub CountProducts()

Dim scol As String

LastRow = ActiveSheet.UsedRange.Rows.Count
Range("A" & LastRow + 3).Select
scol = Chr$(ActiveCell.column + 64)
ActiveCell.Formula = "=counta(" & scol & "2:" & scol & _ ActiveCell.Row
- 1 & ")"

End Sub

and what i need is to either loop once from range A : S or just for
each range do the code, then next until range is S...

can anyone show me how please?


---
Message posted from http://www.ExcelForum.com/


aapp81[_33_]

For | Next ...OR... Do | Loop
 
thank you very much, works great

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 05:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com