ExcelBanter

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

Neal

looping
 
How do I loop this code until the cell that the data is comming from is empty?
Sub clovis_time()
activecell.Offset(0, 0).Range("A1").Select
activecell.FormulaR1C1 = "=(RC[-1]-INT(RC[-1]))*24"

End Sub

Data in b1 is comming from the formula and a1!
Any help would be greatly appreciated, thanks neal.

Ikaabod[_83_]

looping
 

I'm not sure if I understand correctly, but if I do then this should
work for you:
Sub clovis_time()
Dim i As Integer
i = 0
Range("B1").Select
Do
ActiveCell.Offset(i, 0).FormulaR1C1 = "=(RC[-1]-INT(RC[-1]))*24"
i = i + 1
Loop Until IsEmpty(ActiveCell.Offset(i, -1))
End Sub

Neal Wrote:
How do I loop this code until the cell that the data is comming from is
empty?
Sub clovis_time()
activecell.Offset(0, 0).Range("A1").Select
activecell.FormulaR1C1 = "=(RC[-1]-INT(RC[-1]))*24"

End Sub

Data in b1 is comming from the formula and a1!
Any help would be greatly appreciated, thanks neal.



--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=543855


Neal

looping
 
Thank you very much, the code worked great.

"Ikaabod" wrote:


I'm not sure if I understand correctly, but if I do then this should
work for you:
Sub clovis_time()
Dim i As Integer
i = 0
Range("B1").Select
Do
ActiveCell.Offset(i, 0).FormulaR1C1 = "=(RC[-1]-INT(RC[-1]))*24"
i = i + 1
Loop Until IsEmpty(ActiveCell.Offset(i, -1))
End Sub

Neal Wrote:
How do I loop this code until the cell that the data is comming from is
empty?
Sub clovis_time()
activecell.Offset(0, 0).Range("A1").Select
activecell.FormulaR1C1 = "=(RC[-1]-INT(RC[-1]))*24"

End Sub

Data in b1 is comming from the formula and a1!
Any help would be greatly appreciated, thanks neal.



--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=543855




All times are GMT +1. The time now is 02:30 PM.

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