+ Reply to Thread
Results 1 to 2 of 2

values in userform text box.

  1. #1
    Registered User
    Join Date
    03-02-2007
    Posts
    28

    values in userform text box.

    I have a user form that has many text values associated with it, I've added a spin button on to the form but I am not able to retrieve the value of each row and cell to populate the form.

    Here is what I have:

    Sub ShowCurrentRecord()
    Dim Wks As Worksheet

    Set Wks = ThisWorkbook.Worksheets(1)
    With UserForms(0)
    R = .SpinButton1.Value + 1
    .Textbox3 = Wks.Cells(R, "A").Value
    .Textbox2 = Wks.Cells(R, "B").Value
    .Textbox1 = Wks.Cells(R, "C").Value
    .TextBox14 = Wks.Cells(R, "D").Value
    .TextBox15 = Wks.Cells(R, "E").Value
    .TextBox13 = Wks.Cells(R, "F").Value
    .TextBox7.Value = .SpinButton1.Value
    End With
    End Sub

    The problem I have is when I try to run it gives me a variable not defined on this line of code.

    R = .SpinButton1.Value + 1

    What am I missing? Do I have to define r as Row?

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    If you have OPTION EXPLICIT turned on, then yes you will have to define R.

    HTH

    rylo

+ 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