MrExcel Publishing
Your One Stop for Excel Tips & Solutions

loops


Posted by Tony on October 07, 2001 8:36 PM

In a loop I have 2 input boxs which need to return data to the worksheet in consecutive rows(Same Columns)
any help please
Tony


Posted by Juan Pablo on October 08, 2001 7:02 AM

Care to elaborate ? (NT)


Posted by tony on October 08, 2001 6:40 PM

Re: Care to elaborate ? (NT)


Do
If strInputText = ”” Then Exit Do

Set cell1 = Timesheet.Range("a8") 'need to loop this lot till "cancel"
' cell1 = NextCell + 1
cell1 = InputBox("Enter employees name")
Set cell2 = Timesheet.Range("b8")
cell2 = InputBox("Enter hours worked")
Set cell3 = Timesheet.Range("c8")
Timesheet.Range("c8").Formula = "=$b$5*b8"

Loop Until (InputBox = Cancel)

Get the idea I hope
Tony

Posted by Juan Pablo on October 09, 2001 5:22 AM

Re: Care to elaborate ?

Is this what you need ?


Do
If strInputText = ”” Then Exit Do

Set cell1 = Timesheet.Range("a8") 'need to loop this lot till "cancel"
' cell1 = NextCell + 1
text1 = InputBox("Enter employees name")
If text1<>"" then
cell1 = text1
else
Exit Do
End If
Set cell2 = Timesheet.Range("b8")
cell2 = InputBox("Enter hours worked")
Set cell3 = Timesheet.Range("c8")
Timesheet.Range("c8").Formula = "=$b$5*b8"

Loop Until (InputBox = Cancel)

Juan Pablo

Set cell1 = Timesheet.Range("a8") 'need to loop this lot till "cancel" ' cell1 = NextCell + 1 cell1 = InputBox("Enter employees name") Set cell2 = Timesheet.Range("b8") cell2 = InputBox("Enter hours worked") Set cell3 = Timesheet.Range("c8") Timesheet.Range("c8").Formula = "=$b$5*b8"

Posted by Tony on October 09, 2001 5:49 PM

Thanks Juan Pablo.

Set cell1 = Timesheet.Range("a8") 'need to loop this lot till "cancel" ' cell1 = NextCell + 1 cell1 = InputBox("Enter employees name") Set cell2 = Timesheet.Range("b8") cell2 = InputBox("Enter hours worked") Set cell3 = Timesheet.Range("c8") Timesheet.Range("c8").Formula = "=$b$5*b8" : Loop Until (InputBox = Cancel) : Get the idea I hope