Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba solutions a.s.a.p please
i have been given the following questions if anyone could help with a solution to each i would be most greatful because i am new to using vba in excel and im finding is all very confusing 1) produce code that allows a user to input using a input box up to but no more than five manufactures names. to finish entry before five manufactures names have been entered the user should input the word QUIT. after entry is complete the number of names inputed by the user should be displayed in a message box 2) desgin a excel spreadsheet that will allow the registration of votes for the big listen. voters will be allowed to lodge votes for one of five radio programmes. the form should include a cell to allow the entry of a vote(1-5) and a button, cmdSubmit to submit this. the data must be held in an arry. the form should also include display the radio programm names, radio programm numbers and the current score 3)write a function to test whether an integer lies between 0 and 100. this should return a boolean value kind regards relwod -- RELWOD85 ------------------------------------------------------------------------ RELWOD85's Profile: http://www.excelforum.com/member.php...o&userid=25753 View this thread: http://www.excelforum.com/showthread...hreadid=391644 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba solutions a.s.a.p please
Homework ?
Perhaps you could post what you've tried so far. Tim. "RELWOD85" wrote in message ... i have been given the following questions if anyone could help with a solution to each i would be most greatful because i am new to using vba in excel and im finding is all very confusing 1) produce code that allows a user to input using a input box up to but no more than five manufactures names. to finish entry before five manufactures names have been entered the user should input the word QUIT. after entry is complete the number of names inputed by the user should be displayed in a message box 2) desgin a excel spreadsheet that will allow the registration of votes for the big listen. voters will be allowed to lodge votes for one of five radio programmes. the form should include a cell to allow the entry of a vote(1-5) and a button, cmdSubmit to submit this. the data must be held in an arry. the form should also include display the radio programm names, radio programm numbers and the current score 3)write a function to test whether an integer lies between 0 and 100. this should return a boolean value kind regards relwod -- RELWOD85 ------------------------------------------------------------------------ RELWOD85's Profile: http://www.excelforum.com/member.php...o&userid=25753 View this thread: http://www.excelforum.com/showthread...hreadid=391644 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba solutions a.s.a.p please
for question one Private Sub pressHereToInputManufacturesNames_Click() Dim manufacturesName1 As String Dim manufacturesName2 As String Dim manufacturesName3 As String Dim manufacturesName4 As String Dim manufacturesName5 As String Dim i As Integer Dim QUIT As String QUIT = 4 Do Range("a1").Select manufacturesName1 = ActiveCell.Value Range("a2").Select manufacturesName2 = ActiveCell.Value Range("a3").Select manufacturesName3 = ActiveCell.Value Range("a4").Select manufacturesName4 = ActiveCell.Value Range("a5").Select manufacturesName5 = ActiveCell.Value For i = 1 To 1 manufacturesName = InputBox("Enter a manufactures name") Loop If manufacturesName = QUIT Then endloop End If Next i 'MsgBox 'this should display the manufactures names that have bee inouted 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=39164 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba solutions a.s.a.p please
RELWOD85,
A few comments on your code: Saving the names to a sheet was not part of your criteria, but it would be bit pointless to enter the names and just forget them. 1. You "Dim QUIT As String", but them assign QUIT the value 4, a number. Whilst VBA will let you do this, what do mean by it. 2. "manufacturesName1 = ActiveCell.Value" sets the value of manufacturesName1 to that of the active cell, which in a new sheet I guess would be "". What you mean is the opposite: ActiveCell.Value=manufacturesName1 3. On the Range object, you can use .Offset within the loop, so selection is not required. Select is seldom required in VBA.(Hint: Range("A1).Offset(i,0).Value=) 4. Your Do...Loop and For...Next are interleaved: if you had tried this code, you would have seen a compile error, "Do without Loop", I would guess. 5. endloop ? Exit Do ? 6. For i = 1 To 1: How many times does this execute ? 7. Read about the MsgBox syntax in help. You will need to know the number times that the loop has executed (Hint: what is the value of i) and add this to you prompt text. 8. "If manufacturesName = QUIT" ; what is the value of QUIT ? 9. What if the user clicks the Cancel button ? You should at least try to run your code before you post. The help would have explained some of the above and VBA would have errored on the syntax/compile errors. Have another go and see what you can up with, making sure it can actually run. Post back and we'll make comments NickHK "RELWOD85" wrote in message ... for question one Private Sub pressHereToInputManufacturesNames_Click() Dim manufacturesName1 As String Dim manufacturesName2 As String Dim manufacturesName3 As String Dim manufacturesName4 As String Dim manufacturesName5 As String Dim i As Integer Dim QUIT As String QUIT = 4 Do Range("a1").Select manufacturesName1 = ActiveCell.Value Range("a2").Select manufacturesName2 = ActiveCell.Value Range("a3").Select manufacturesName3 = ActiveCell.Value Range("a4").Select manufacturesName4 = ActiveCell.Value Range("a5").Select manufacturesName5 = ActiveCell.Value For i = 1 To 1 manufacturesName = InputBox("Enter a manufactures name") Loop If manufacturesName = QUIT Then endloop End If Next i 'MsgBox 'this should display the manufactures names that have been inouted End Sub RELWOD85 ------------------------------------------------------------------------ RELWOD85's Profile: http://www.excelforum.com/member.php...o&userid=25753 View this thread: http://www.excelforum.com/showthread...hreadid=391644 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF formula with many solutions. | New Users to Excel | |||
Are there any solutions for truckers? | Excel Programming | |||
Looking for Solutions | Excel Programming | |||
Spreadsheet Solutions | Excel Programming | |||
Looking for Solutions | Excel Programming |