Thread: help with loop
View Single Post
  #1 (permalink)  
Old August 3rd, 2012, 09:25 PM
pooky pooky is offline
Authorized User
 
Join Date: Jan 2012
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default help with loop

Wanting the input box repeat four times, that part of code works. However, I want the new values to be entered on the next empty row of worksheet of column 5 or ("E").
Ex:
Enter Weight of cavity #1
Answer: 325
Enter Weight of cavity #2
Answer: 328
Enter Weight of cavity #3
Answer: 563
Enter Weight of cavity #4
Answer: 569

Each answer should advance down in column 5.

Code:
Sub GetWeight()
    i = 0
    'Determine emptyRow
    emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
    For i = 1 To 4
        Weight = InputBox("Enter Weight of cavity #" & i)
        Cells(emptyRow, 5).Value = Weight.Value (Runtime error 424 occurs here) 
        If TieWeight = "" Then Exit Sub
    Next i
End Sub
Hope that make sense. Thanks to all for help.

Last edited by pooky; August 3rd, 2012 at 09:28 PM..