LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vba advice how 2get a input box to quit by entering the word quit+ 4 a msgbox to disp


i have been doing the following coding which allows me to input throug
a input box 5 names this works however i would first of all like t
enter the word QUIT before the 5th name is inputed so that i dont hav
to input anymore then the second thind i want to do is get a messag
box to appear after its has quit to show in numbers how many names hav
been put in for example if only two names have been put in before th
word quit is entered i then would like a message box to appear with "2
in it. if anyone can help i would be so greatful. below is my coding


Private Sub pressHereToInputManufacturesNames_Click()

Dim manufacturersName1$
Dim manufacturersName2$
Dim manufacturersName3$
Dim manufacturersName4$
Dim manufacturersName5$
Dim i As Integer
Dim rRange As Excel.Range
Dim strtext$
Set rRange = Range("a1", Range("a1").End(xlUp))
Dim iTheRows As Long

'the below message box instructs the user to enter the word QUIT befor
they input a fifth
'manufacturers name the use of "&vbCrlf" in the coding forces a brea
in the line of the message

MsgBox "Please can you enter the word QUIT befor putting in
manufacturers names" & vbCrLf & "its up to you when you do it aslong a
it is before the 5th name Thankyou"

With ActiveSheet
manufacturesName1 = InputBox("Manufactorsname 1")
.[a1].Value = manufacturesName1
manufacturesName2 = InputBox("Manufactorsname 2")
.[a2].Value = manufacturesName2
manufacturesName3 = InputBox("Manufactorsname 3")
.[a3].Value = manufacturesName3
manufacturesName4 = InputBox("Manufactorsname 4")
.[A4].Value = manufacturesName4
manufacturesName5 = InputBox("Manufactorsname 5")
.[a5].Value = manufacturesName5

End With

' this below section of coding selects the cells which the manufacture
names have been inputted into

iTheRows = rRange.Rows.Count
[a1,a2,a3,a4,a5].Select

' the below section of coding makes another message box come up showin
the manufactures names that have been inputted

'in here i want to i think put coding in to make it stop when the wor
quit is put into the input box

'then after this i want the message box to display as a interger ho
many names in total have been inputed into the cell range a1:a5


For i = 1 To iTheRows Step 1
strtext$ = strtext$ & ActiveCell.Value & vbCrLf
Next i
MsgBox strtext$


End Su

--
RELWOD8
-----------------------------------------------------------------------
RELWOD85's Profile: http://www.excelforum.com/member.php...fo&userid=2575
View this thread: http://www.excelforum.com/showthread.php?threadid=39183

 
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
Quit solomon_monkey[_2_] Excel Programming 7 July 6th 05 05:18 PM
Application.Quit bawahoo[_2_] Excel Programming 2 October 14th 04 08:33 PM
Can't get Excel to quit Todd Waldron Excel Programming 10 November 22nd 03 03:19 PM
Excel won't quit Jeff[_23_] Excel Programming 0 October 24th 03 05:14 PM
Quit Application Robert Black Excel Programming 1 July 31st 03 04:15 PM


All times are GMT +1. The time now is 04:18 AM.

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

About Us

"It's about Microsoft Excel"