Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Filling form text boxes from cells. Incredibly simple I know, but I'm new. :-(

I'm helping to run a raffle for our Rotary group. They've sold 30,000
tickets and are having a big posh evening to draw the prizes. As I had
a laptop and a projector, I was volunteered to knock up a display
program for the night.

I have a workbook with all the groups, and their ticket allocations on
sheet1. I also have the makings of a rudimentary random number
generator which I'll beat into shape fairly quickly. But, the project
as described to me makes it necessary to display the winning
organisations in a 2nd textbox below the winnign number.

For example, if sheet1 contains

Hospice 21101 21500 400
Youth football 21501 21650 150

And the random number generator throws up 21123, I want textbox2.value
to equal $A$1. Now, in the example below, if I insert $a$1 manually,
it does, but if I try and introduce a variable (which I'll write a
quick algorithm for later), in our example R=1 for tickets
21101-21500, and 2 for higher values. $a$R just throws up errors. This
HAS to be so simple it's stupid, yet I've been here trying for 3
hours. .... i DID say I was new to this! (< brackets are my additions
for this post)


Private Sub CommandButton1_Click()

Dim R As Integer: R = ActiveCell.Row

X = Int(Rnd() * 30000) + 10000 <first ticket numbered 10000, dont
panic
TextBox1.Value = X

R = 20

TextBox2.Value = Sheet1.[$A$R]

End Sub
<et voila, type mismatch error
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
Link Text Boxes on Form? Joyce Excel Discussion (Misc queries) 8 September 1st 09 06:20 AM
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
Struggling to produce INCREDIBLY simple charts with Excel (v2003) - any recommendations? ship Charts and Charting in Excel 3 June 19th 06 11:07 PM
Form Text Boxes moving md2503 Excel Worksheet Functions 2 May 16th 05 07:57 PM
Numerical accuracy in Form Text-boxes steve Excel Programming 2 August 23rd 03 02:34 AM


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

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"