+ Reply to Thread
Results 1 to 1 of 1

Assigning Information To Sheets By Name and Location IDs

  1. #1
    Registered User
    Join Date
    01-30-2013
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    30

    Assigning Information To Sheets By Name and Location IDs

    So I want it to go from 2 to 100 in column E, Pull out a number based location ID, Assign it to a location (Group A, Group B, Etc.) then, After finding this location, go to the sheet for said location, Find the name associated with the location, and post associated pre and post test scores in the proper columns for each person.

    This is what I have currently:


    Function SeparateByLocation()
    Dim JobLoc As Long
    Dim xPos As Integer
    Dim Jstring As String
    Dim Prescore As Integer
    Dim Postscore As Integer


    Sheets("Fill").Select
    ' E2.Select
    xPos = ActiveCell.Column
    Prescore = Cells(ActiveCell.Row, xPos + 2)
    Postscore = Cells(ActiveCell.Row, xPos + 3)

    While Not JobLoc
    JobLoc = ActiveCell.Value
    If JobLoc = 380104 Then
    Jstring = "Abilene"
    ElseIf JobLoc = 350111 Then Jstring = "Group A"
    ElseIf JobLoc = 264003 Then Jstring = "Group B"
    ElseIf JobLoc = 330111 Then Jstring = "Group C"
    ElseIf JobLoc = 240103 Then Jstring = "Group D"
    ElseIf JobLoc = 244006 Then Jstring = "Group E"
    ElseIf JobLoc = 251211 Then Jstring = "Group F"
    ElseIf JobLoc = 232211 Then Jstring = "Group G"
    ElseIf JobLoc = 290105 Then Jstring = "Group H"
    ElseIf JobLoc = 355011 Then Jstring = "Group I"
    ElseIf JobLoc = 340102 Then Jstring = "Group J"
    ElseIf JobLoc = 360102 Then Jstring = "Group K"
    ElseIf JobLoc = 320103 Then Jstring = "Group L"
    ElseIf JobLoc = 326002 Then Jstring = "Group M"
    ElseIf JobLoc = 373002 Then Jstring = "Group N"
    ElseIf JobLoc = 280311 Then Jstring = "Group O"
    ElseIf JobLoc = 230103 Then Jstring = "Group P"
    ElseIf JobLoc = 250111 Then Jstring = "Group Q"
    ElseIf JobLoc = 370102 Then Jstring = "Group R"
    ElseIf JobLoc = 327106 Then Jstring = "Group S"
    ElseIf JobLoc = 342003 Then Jstring = "Group T"
    ElseIf JobLoc = 310103 Then Jstring = "Group U"
    Else
    Jstring = "Group V"
    Call DropThem(Jstring, Prescore, Postscore)

    ActiveCell.End(xlDown).Select
    End If
    Wend
    End Function

    Sub DropThem(Location As String, s1 As Integer, s2 As Integer)
    Dim NameCell As String

    NameCell Cells(ActiveCell.Row, ActiveCell.Column - 2).Value
    Sheet(Location).Select
    Call FindThem(NameCell, s1, s2)
    End Sub

    Sub FindThem(Name As String, s1 As Integer, s2 As Integer)
    Dim walkY As Integer
    Dim Found
    walkY = 6
    Found = False

    While Not Found
    If Name = Cells(3, walkY).Value Then
    Cells(walkY, 6).Value = s1
    Cells(walkY, 7).Value = s2
    Found = True
    Else
    walkY = walkY + 1

    'If the name is not in the location this will be an infinite loop
    End If
    Wend

    End Sub


    It doesn't seem to see the ElseIf parts for the If Statement.
    Last edited by ExcelWizards; 01-31-2013 at 03:50 PM. Reason: UPDATE

+ 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