Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Demyan Nonob   on Aug 26 In MS Office Category.

  
Question Answered By: Daniel Evans   on Aug 26

You don't need the intervening sheet WLWE at all, you do no checks on
it before deleting the data there so:

Private Sub Workbook_Open()
Dim MyInput
Do
NextRow = Worksheets("Email_Data").Range("A65536").End(xlUp).Row + 1
MyInput = InputBox("Enter your Email Address")
If UCase(MyInput) <> "END" Then
MsgBox "Hello " & MyInput & " Thanks for entering  the contest & Good Luck"
Worksheets("Email_Data").Cells(NextRow, 1) = MyInput
End If
Loop Until UCase(MyInput) = "END"
End Sub

A formal Do Loop is in there instead of just recalling the macro.
The UCase bits cater for any combination of upper and lower case
letters making up the word 'end'.
Since you haven't declared NextRow, you don't really need to declare
MyInput either (ie. the Dim MyInput line can be left out).
One or two of the lines above may have been wordwrapped so you'll have
to restore it/them.

Share: