PC Review


Reply
Thread Tools Rate Thread

data from the spreadsheet into a form

 
 
nureen_lakhani1@hotmail.com
Guest
Posts: n/a
 
      31st Jul 2007
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 With Quote
 
 
 
 
Zone
Guest
Posts: n/a
 
      31st Jul 2007
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

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data passed to spreadsheet from Form. How to reload the spreadsheetdata into the Form? Morlin Microsoft Excel Programming 5 20th Jul 2009 10:59 PM
excel form. Need data extracted to spreadsheet each time a form co MikeR-Oz Microsoft Excel Misc 4 5th Apr 2009 05:18 AM
Can't send data from form to spreadsheet. =?Utf-8?B?Q2xhcmsgS2VudA==?= Microsoft Excel Misc 1 22nd Feb 2007 05:41 PM
spreadsheet object imbeded in a custom form, data not coming with sent form. dh Microsoft Outlook VBA Programming 5 14th Apr 2004 09:32 PM
Getting data from user form into spreadsheet brian Microsoft Excel Misc 2 13th Aug 2003 11:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:25 AM.