Looping Through An Array

Joined
Jul 6, 2008
Messages
4
Reaction score
0
Hi,

For this code, I have two columns of unknown length. One is a total time column in hh:mm format and the other is a goal met column. I'm trying to make the value in the goal met column "Yes" if the total time is less than or equal to ten minutes and "No" otherwise. So far my code runs without errors, but makes all the values in the goal met column "Yes", even if the time is greater than 10 minutes. HELP!

Code:
Sub Goal_Met_Check() 
Dim Total_Time As Range
Dim Goal_Met As Range
 
Set Total_Time = Application.InputBox(Prompt:="Please select the total time range with your mouse.", Title:="Specify Total Time Range", Type:=8)
Set Goal_Met = Application.InputBox(Prompt:="Please select the goal met range with your mouse.", Title:="Specify Goal Met Range", Type:=8)
For Each Total_Time In Selection
	If Total_Time.Value <= 0.01 Then
		 Goal_Met.Value = "Yes"
	 Else
		 Goal_Met.Value = "No"
	 End If
Next
End Sub
 
Back
Top