+ Reply to Thread
Results 1 to 4 of 4

Form stopped working when I rearranged the tab order - please help

  1. #1
    Registered User
    Join Date
    07-02-2012
    Location
    Nashville TN
    MS-Off Ver
    Excel 2007
    Posts
    3

    Form stopped working when I rearranged the tab order - please help

    I built a form to send information to the first available row in a spreadsheet. It worked great! Then I realized the tab button was moving through the form in the wrong order, so I rearranged the tabs. Now my form will not enter the data into the last row (or anywhere as best as I can tell).
    Can you see anything I am doing wrong here? Please help and thank you for your time.

    Here is the code for the form:

    Private Sub cmdAdd_Click()
    Dim iRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("LockClub-Sports")
    iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
    If Trim(Me.txtdate.Value) = "" Then
    Me.txtdate.SetFocus
    MsgBox "Please enter a date"
    Exit Sub
    End If
    ws.Cells(iRow, 2).Value = Me.txtdate.Value
    ws.Cells(iRow, 3).Value = Me.txtsport.Value
    ws.Cells(iRow, 4).Value = Me.txtteam.Value
    ws.Cells(iRow, 5).Value = Me.txtunit.Value
    ws.Cells(iRow, 6).Value = Me.txtline.Value
    ws.Cells(iRow, 7).Value = Me.txtbet.Value
    ws.Cells(iRow, 8).Value = Me.txttowin.Value
    ws.Cells(iRow, 9).Value = Me.txtwl.Value
    ws.Cells(iRow, 10).Value = Me.txtwl2.Value

    Me.txtdate.Value = ""
    Me.txtsport.Value = ""
    Me.txtteam.Value = ""
    Me.txtunit.Value = ""
    Me.txtline.Value = ""
    Me.txtbet.Value = ""
    Me.txttowin.Value = ""
    Me.txtwl.Value = ""
    Me.txtwl2.Value = ""
    Me.txtdate.SetFocus

    End Sub

    Private Sub cmdClose_Click()
    Unload Me
    End Sub

    Private Sub ComboBox1_Change()

    End Sub

    Private Sub UserForm_Click()

    End Sub

    form.JPGtab order.JPG

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Form stopped working when I rearranged the tab order - please help

    Tab order will not affect how the data is written to the sheet.

    Also, you need to use code tags when posting code to the forum.

    A picture may be worth a thousand words, but for help with a spreadsheet you can't beat an example spreadsheet!
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    07-02-2012
    Location
    Nashville TN
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Form stopped working when I rearranged the tab order - please help

    Here is the code in a code tag. Also I have attached the spreadsheet for those of you kind enough to take a look at it. This is my first form, so please be kind.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Form stopped working when I rearranged the tab order - please help

    It's nothing to do with Tab Order. lRow isn't being given a value. Your work sheet isn't really desined to be used witha data entry form

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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