+ Reply to Thread
Results 1 to 2 of 2

Value from wrong column

Hybrid View

  1. #1
    Registered User
    Join Date
    06-22-2007
    Posts
    42

    Value from wrong column

    Here's my code:

    Private Sub AmendOK_Click()
    
    Dim rowindex As Integer
    
    
    rowcount = Sheet2.Rows.Count
    If rowcount > 2500 Then rowcount = 2500
    For x = 2 To rowcount
    
    
    If Sheets(2).Cells(x, 1) = txtTraineeName And Sheets(2).Cells(x, 5) = CDate(txtWeekEndingDate) Then
    
    rowindex = x
    
    x = rowcount
    
    End If
    
    Next x
    
    Sheets(2).Cells(rowindex, 1).Value = txtTraineeName.Value
    txtTraineeName.Value = Sheets(2).Cells(rowindex, 1).Value
    
    Sheets(2).Cells(rowindex, 5).Value = txtWeekEndingDate.Value
    txtWeekEndingDate.Value = Sheets(2).Cells(rowindex, 5).Value
    
    Sheets(2).Cells(rowindex, 10).Value = txtOOEAchieved.Value
    txtOOEAchieved.Value = Sheets(2).Cells(rowindex, 10).Value
    
    Sheets(2).Cells(rowindex, 11).Value = txtOOETarget.Value
    txtOOETarget.Value = Sheets(2).Cells(rowindex, 11).Value
    
    Sheets(2).Cells(rowindex, 12).Value = txtWRAchieved.Value
    txtWRAchieved.Value = Sheets(2).Cells(rowindex, 12).Value
    
    Sheets(2).Cells(rowindex, 13).Value = txtWRTarget.Value
    txtWRTarget.Value = Sheets(2).Cells(rowindex, 13).Value
    
    Sheets(2).Cells(rowindex, 14).Value = txtQCAchieved.Value
    txtQCAchieved.Value = Sheets(2).Cells(rowindex, 14).Value
    
    Sheets(2).Cells(rowindex, 15).Value = txtQCTarget.Value
    txtQCTarget.Value = Sheets(2).Cells(rowindex, 15).Value
    
    Sheets(2).Cells(rowindex, 17).Value = txtTrainerOOEAchieved.Value
    txtTrainerOOEAchieved.Value = Sheets(2).Cells(rowindex, 17).Value
    
    Sheets(2).Cells(rowindex, 18).Value = txtTrainerOOETarget.Value
    txtTrainerOOETarget.Value = Sheets(2).Cells(rowindex, 18).Value
    
    Sheets(2).Cells(rowindex, 19).Value = txtTrainerWRAchieved.Value
    txtTrainerWRAchieved.Value = Sheets(2).Cells(rowindex, 19).Value
    
    Sheets(2).Cells(rowindex, 20).Value = txtTrainerWRTarget.Value
    txtTrainerWRTarget.Value = Sheets(2).Cells(rowindex, 20).Value
    
    
    
     Unload AmendData
    End Sub
    Now, here's my problem:
    The part of the code that is populating my Userform with the contents of column 17 (txtTrainerOOEAchieved) is actually populating with the data from column 16. I have looked and looked and looked at it for the whole morning but cannot see what is wrong with it.

    Please help. I have to present this in 2 hours and it's the only bit that's not working now.

    Thanks from a desperate me.

  2. #2
    Registered User
    Join Date
    06-22-2007
    Posts
    42
    Please ignore - user error! Hadn't changed the column numbers in a separate bit of code

+ 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