I first of all thank you all for your efforts in helping ...I "think " I am slowly grasping things more and more everyday but with For Each statements, I still have some problems..looking at the code below
What I wish to happen is that For Each value in the range of C3:C17 the number should populate the corresponding S3:S17 cell For example, the first loop checks C3, and finds the string FR, it therefore populate S3 with the integer 1. Next it should check cell C4 and whichever string it finds, FR, SO, JR, or SR it should populate the corresponding S cell (or S4) , C5 answer would populate cell S5 with the integer. My loop seems to be able to check the C range correctly, finds the right integer to populate, but its populating the entire range of S3:S17 rather than a single cell. How would I change this so that C3 integer value populates S3, C4 integer value populates S4, C5 integer value goes to S5 etc?
Thanks for the help.
Code:
Dim MyPlayer As Range
For Each MyPlayer In Range("C3:C17")
If MyPlayer.Value = "FR" Then
Range("S3:S17").Value = 1
ElseIf MyPlayer.Value = "SO" Then
Range("S3:S17").Value = 2
ElseIf MyPlayer.Value = "JR" Then
Range("S3:S17").Value = 3
ElseIf MyPlayer.Value = "SR" Then
Range("S3:S17").Value = 4
ElseIf MyPlayer.Value = "" Then
Range("S3").Value = 4
End If
Next MyPlayer
What I wish to happen is that For Each value in the range of C3:C17 the number should populate the corresponding S3:S17 cell For example, the first loop checks C3, and finds the string FR, it therefore populate S3 with the integer 1. Next it should check cell C4 and whichever string it finds, FR, SO, JR, or SR it should populate the corresponding S cell (or S4) , C5 answer would populate cell S5 with the integer. My loop seems to be able to check the C range correctly, finds the right integer to populate, but its populating the entire range of S3:S17 rather than a single cell. How would I change this so that C3 integer value populates S3, C4 integer value populates S4, C5 integer value goes to S5 etc?
Thanks for the help.
Last edited: