ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   looping through range (https://www.excelbanter.com/excel-programming/408278-looping-through-range.html)

[email protected]

looping through range
 
I have a range withing a list, i wish to loop throught the range
without activating the cells and in each blank cell put todays date
in. I am using a do loop but I am struggling, possible need a for loop
but I am not to good on these, any advice much grateful

John

Mike H

looping through range
 
Hi,

There are several ways of which this one may meet your needs

Sub versive()
Set myrange = Range("A1:A10") 'Change to suit
For Each c In myrange
If IsEmpty(c) Then
c.Value = Date
End If
Next
End Sub

Mike

" wrote:

I have a range withing a list, i wish to loop throught the range
without activating the cells and in each blank cell put todays date
in. I am using a do loop but I am struggling, possible need a for loop
but I am not to good on these, any advice much grateful

John



All times are GMT +1. The time now is 03:01 AM.

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