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 Arrays and cell values


hi there im having trouble with adding values to a cell and linking them
to my arrays. basicly what i want to do is input the number from 1-5
into cell F12, this representing a vote for a radio program. once the
number 1-5 has been put into the cell i then want to add the integer
one to the corrisponding cell for that radio programe that i have
created. but im having alot of trouble doing this. i can get one to
be added to the first cell in my table if i put < in but this is not
what i want. i want the number be to be loked up in the array and then
1 to be added onto the score each time. the below is the coding that i
have done so far, please can someone help me it is driving me around
the bend, because i am new to VBA programming and im having alot of
trouble understanding it all.

Private Sub Submit_Click()
Dim radioProgramName(5) As String, radioProgramNumber(5) As Single
Dim submitScore As Integer

radioProgramName(1) = "talk sport"
radioProgramName(2) = "talk garden"
radioProgramName(3) = "talk DIY"
radioProgramName(4) = "talk talk"
radioProgramName(5) = "talk weather"

radioProgramNumber(1) = 1
radioProgramNumber(2) = 2
radioProgramNumber(3) = 3
radioProgramNumber(4) = 4
radioProgramNumber(5) = 5

'this is another way of holding the data in an array i think but i am
not sure so i have done it the other way below too.
'radioProgramName(5) = Array("talk sport", "talk garden", "talk DIY",
"talk talk", "talk weather")
'radioProgramNumber(5) = Array("54", "98", "45", "63", "30")

If Range("f12").Select = "1" Then
submitScore = Range("f12").Value = Range("d12").Value
Range("d12").Value = Range("d12").Value + 1
End If

If Range("f12").Select = "2" Then
submitScore = Range("f12").Value = Range("d13").Value
Range("d13").Value = Range("d13").Value + 1
End If

If Range("f12").Select = "3" Then
submitScore = Range("f12").Value = Range("d14").Value
Range("d14").Value = Range("d14").Value + 1
End If

If Range("f12").Select = "4" Then
submitScore = Range("f12").Value = Range("d15").Value
Range("d15").Value = Range("d15").Value + 1

End If

If Range("f12").Select = "5" Then
submitScore = Range("f12").Value = Range("d16").Value
Range("d16").Value = Range("d16").Value + 1
End If


End Sub


--
RELWOD85
------------------------------------------------------------------------
RELWOD85's Profile: http://www.excelforum.com/member.php...o&userid=25753
View this thread: http://www.excelforum.com/showthread...hreadid=393046

 
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 do I compare values in two arrays in Excel? Irrylath Excel Discussion (Misc queries) 1 August 1st 08 12:51 AM
retrieve duplicate values from arrays Mary Excel Discussion (Misc queries) 6 February 27th 07 07:11 AM
Using CORREL with arrays containing null values rmellison Excel Discussion (Misc queries) 1 November 11th 05 03:02 PM
Storing values to arrays for subsequent use Peter Rooney Excel Programming 3 July 29th 05 09:00 AM
Ranges and Arrays - Passing values Don Lloyd Excel Programming 4 October 19th 04 03:18 AM


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