+ Reply to Thread
Results 1 to 3 of 3

Display the values in form that pull from another sheet which should not the editable

  1. #1
    Registered User
    Join Date
    09-29-2010
    Location
    chennai
    MS-Off Ver
    Excel 2003
    Posts
    1

    Display the values in form that pull from another sheet which should not the editable

    Friends I'm a beginner for Excel VBA. Here is problem. Currently I'm leading a team. I have Part numbers in Colum "A". And I have Part name in Colum "B", and I have estimation hours in coloum"C". Now I have created an Form with the text box and command box (Please see the attachment"). Which will display the values for Colum “A”,”B”,”C”. When I ran the macro seem all the values are pulling correctly however I want the user can not edit the values showing the text box. Can any one help me in this
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    12-10-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Display the values in form that pull from another sheet which should not the editable

    Funny, I posted a thread because I'm trying to do the opposite - I want my values to be editable...but so far no takers.

    I assume that information is not input into your form by the user but that the form is only used to display information for the user.

    I don't think that information typed into the texboxes will change your database without code instructing the program to overwrite the information in your database and a SAVE button...at least that is my experience.

    But instead of using textboxes why don't you use labels? Labels are not editable and they will display the information from your database for the user to see. Here is an example (I know you said you're using a command box and my code uses a listbox but this example was done in VBA - and I used a listbox for my project).


    Private Sub ListBox1_Change()

    Dim SourceData As Range
    Dim Val1 As String, Val2 As String, Val3 As String, Val4 As String

    Set SourceRange = Range(ListBox1.RowSource)

    Val1 = ListBox1.Value
    Val2 = SourceRange.Offset(ListBox1.ListIndex, 1).Resize(1, 1).Value
    Val3 = SourceRange.Offset(ListBox1.ListIndex, 2).Resize(1, 1).Value
    Val4 = SourceRange.Offset(ListBox1.ListIndex, 3).Resize(1, 1).Value



    Label1.Caption = Val1
    Label2.Caption = Val2
    Label3.Caption = Val3
    Label4.Caption = Val4



    End Sub

  3. #3
    Registered User
    Join Date
    12-10-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Display the values in form that pull from another sheet which should not the editable

    Sorry, I should add...drag four label boxes over to your form.

    Then drag a listbox to your form. Double click on the list box and add the above code. The list box is used to scroll through the items to find the part.

    In the listbox properties do this:

    Make the BoundColumn say 1
    Make the ColumnCount say 4 (because you have four columns in your database)
    Make the ColumnHeads say either True or False - Most like True but I use False

    Then make the RowSource say the name of your worksheet plus the column where your part numbers are: sheet1!A1:A300

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1