tf37
Board Regular
- Joined
- Apr 16, 2004
- Messages
- 169
Found this thread from 2010, but wish to expand on its function
My commented lines show what I’d like to do with it, but in short
' if user entered with no value, it should resume at that place it left off in the row population
' as it is, it is skipping a row and leaving a blank row with no value
' need correction to back up and resume where it left off to populate rows in sequence - no blanks until 999 is entered
' i'd still like a msgbox to inform the data input person that they accidently pressed enter without proper exit with 999
' if it isn't a major code project that is, otherwise, just continue but in row sequence with no blank rows until 999 is entered to finish
' plus the input box at the beginning displays "ok" and "cancel", suppose that is by default, can those be removed allowing only a 999 to exit?
As always, thanks gang for your input and suggestions
Sub fill()
Dim c As Range
Set c = ActiveCell
c = Range("A2:A91") 'inserted to select my range to use- works ok
Range("A2").Select ' inserted again to select my range to use - works ok
For i = 0 To 1
For j = 0 To 99
val1 = InputBox("Please enter number", "Enter Number, Enter 999 To Finish")
If val1 = "999" Then
Exit Sub
Else
c.Offset(j, i).Value = val1
If val1 = "" Then
MsgBox "You blew it if your are not done"
' if user entered with no value, it should resume at that place it left off in the row population
' as it is, it is skipping a row and leaving a blank row with no value
' need correction to back up and resume where it left off to populate rows in sequence - no blanks until 999 is entered
' i'd still like a msgbox to inform the data input person that they accidently pressed enter without proper exit with 999
' if it isn't a major code project that is, otherwise, just continue but in row sequence with no blank rows until 999 is entered to finish
' plus the input box at the beginning displays "ok" and "cancel", suppose that is by default, can those be removed allowing only a 999 to exit?
End If
End If
Next j
Next i
End Sub
My commented lines show what I’d like to do with it, but in short
' if user entered with no value, it should resume at that place it left off in the row population
' as it is, it is skipping a row and leaving a blank row with no value
' need correction to back up and resume where it left off to populate rows in sequence - no blanks until 999 is entered
' i'd still like a msgbox to inform the data input person that they accidently pressed enter without proper exit with 999
' if it isn't a major code project that is, otherwise, just continue but in row sequence with no blank rows until 999 is entered to finish
' plus the input box at the beginning displays "ok" and "cancel", suppose that is by default, can those be removed allowing only a 999 to exit?
As always, thanks gang for your input and suggestions
Sub fill()
Dim c As Range
Set c = ActiveCell
c = Range("A2:A91") 'inserted to select my range to use- works ok
Range("A2").Select ' inserted again to select my range to use - works ok
For i = 0 To 1
For j = 0 To 99
val1 = InputBox("Please enter number", "Enter Number, Enter 999 To Finish")
If val1 = "999" Then
Exit Sub
Else
c.Offset(j, i).Value = val1
If val1 = "" Then
MsgBox "You blew it if your are not done"
' if user entered with no value, it should resume at that place it left off in the row population
' as it is, it is skipping a row and leaving a blank row with no value
' need correction to back up and resume where it left off to populate rows in sequence - no blanks until 999 is entered
' i'd still like a msgbox to inform the data input person that they accidently pressed enter without proper exit with 999
' if it isn't a major code project that is, otherwise, just continue but in row sequence with no blank rows until 999 is entered to finish
' plus the input box at the beginning displays "ok" and "cancel", suppose that is by default, can those be removed allowing only a 999 to exit?
End If
End If
Next j
Next i
End Sub
Last edited: