Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default data from the spreadsheet into a form

Hey

Any help on this one would be really appreciated!

I need to get the data from a particular row within a spreadsheet -
into a form which I have designed using Visual Basic. I have created
the form.

The user would put in the reference number - which would refer to
column a in the spreadsheet and then all the relative data would come
up in the boxes with the form - the user would then be able to print
of the form???

If anyone could let me know what I need to do - or point to a tutorial
which can help me - please let me know.

Thank you
Nureen x

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 373
Default data from the spreadsheet into a form

Nureen, here's one way to do it. Show your form in the VBA editor. Add a
button to your form to fetch the data from the spreadsheet once the
reference number has been entered. Set the button's caption to "Get Data"
and attach this code to the button:
Private Sub CommandButton1_Click()
Dim j As Long
For j = 2 To Cells(65536, "a").End(xlUp).Row
If CStr(Cells(j, "a")) = Me.TextBox1 Then
Me.TextBox2 = Cells(j, "b")
Me.TextBox3 = Cells(j, "c")
Exit For
End If
Next j
End Sub
I have just assumed the data you want to show is in columns B and C. Of
course, you will need to add more lines as needed and change the names of
the text boxes and the cell references as appropriate.

To print the form, add a button and set its caption to Print. Attach this
code to that button:
Private Sub CommandButton2_Click()
Me.PrintForm
End Sub

HTH, James

wrote in message
oups.com...
Hey

Any help on this one would be really appreciated!

I need to get the data from a particular row within a spreadsheet -
into a form which I have designed using Visual Basic. I have created
the form.

The user would put in the reference number - which would refer to
column a in the spreadsheet and then all the relative data would come
up in the boxes with the form - the user would then be able to print
of the form???

If anyone could let me know what I need to do - or point to a tutorial
which can help me - please let me know.

Thank you
Nureen x



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
excel form. Need data extracted to spreadsheet each time a form co MikeR-Oz Excel Discussion (Misc queries) 4 April 5th 09 05:18 AM
Can't send data from form to spreadsheet. Clark Kent Excel Discussion (Misc queries) 1 February 22nd 07 05:41 PM
How do I Take Data from XL Form and input to spreadsheet? HarryJ Excel Programming 3 October 4th 06 06:44 PM
How do I create a 1pg form for each row of data in a spreadsheet? khoffmann64 Excel Discussion (Misc queries) 0 April 20th 06 08:43 PM
How can I transpose data from a spreadsheet into a form that does. Joby Excel Worksheet Functions 3 November 30th 04 04:50 PM


All times are GMT +1. The time now is 11:40 PM.

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"