Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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
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
IF formula with many solutions. Jaime.CIS New Users to Excel 5 December 7th 06 08:25 PM
Are there any solutions for truckers? Driver[_2_] Excel Programming 0 April 23rd 05 09:30 PM
Looking for Solutions Tom Ogilvy Excel Programming 0 June 21st 04 04:51 PM
Spreadsheet Solutions Perminant Template[_2_] Excel Programming 1 June 16th 04 12:46 AM
Looking for Solutions Tony Johnson Excel Programming 6 August 14th 03 03:03 PM


All times are GMT +1. The time now is 04:10 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"