#1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,069
Default Msgbox loop

I am trying to establish a macro with a message box to loop through until the
Yes button is pressed. I am using Excel 2003. My code is below:

Sub Test()
Dim PartNum As String

Do
PartNum = InputBox("Enter in Part Number:", "Part Number")
If PartNum = "" Then End
If MsgBox("The Part Number is: " & PartNum, vbYesNo) < vbYes Then
End If
Loop Until vbYesNo = vbYes

Worksheets("Sheet1").Range("H10").Value = PartNum
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4,393
Default Msgbox loop

Not sure what you are doing with part no, but this solves the Msgbox thing

Sub Test()
Dim PartNum As String

Do
PartNum = InputBox("Enter in Part Number:", "Part Number")
If PartNum = "" Then End
myans = MsgBox("The Part Number is: " & PartNum, vbYesNo)

Loop Until myans = vbYes
Worksheets("Sheet1").Range("H10").Value = PartNum

End Sub

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"John" wrote in message
...
I am trying to establish a macro with a message box to loop through until
the
Yes button is pressed. I am using Excel 2003. My code is below:

Sub Test()
Dim PartNum As String

Do
PartNum = InputBox("Enter in Part Number:", "Part Number")
If PartNum = "" Then End
If MsgBox("The Part Number is: " & PartNum, vbYesNo) < vbYes Then
End If
Loop Until vbYesNo = vbYes

Worksheets("Sheet1").Range("H10").Value = PartNum
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 7,247
Default Msgbox loop


Use code like

Dim Res As VbMsgBoxResult
Dim PartNum As String
Do
PartNum = InputBox("Enter part number")
If PartNum = vbNullString Then
Exit Sub
End If
Res = MsgBox("The part number is: " & PartNum, vbYesNo)
Loop Until Res = vbYes

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Fri, 13 Feb 2009 07:04:01 -0800, John
wrote:

I am trying to establish a macro with a message box to loop through until the
Yes button is pressed. I am using Excel 2003. My code is below:

Sub Test()
Dim PartNum As String

Do
PartNum = InputBox("Enter in Part Number:", "Part Number")
If PartNum = "" Then End
If MsgBox("The Part Number is: " & PartNum, vbYesNo) < vbYes Then
End If
Loop Until vbYesNo = vbYes

Worksheets("Sheet1").Range("H10").Value = PartNum
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I get a msgbox? AND Excel Discussion (Misc queries) 0 February 12th 09 12:47 PM
msgbox in VBA peyman Excel Discussion (Misc queries) 6 October 6th 07 09:35 PM
msgbox peyman Excel Discussion (Misc queries) 5 October 4th 07 09:56 PM
msgbox peyman Excel Discussion (Misc queries) 2 September 29th 07 08:21 PM
Msgbox Wildman Excel Worksheet Functions 1 April 26th 05 04:57 AM


All times are GMT +1. The time now is 04:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"