Dear all I am trying to write a vba with no luck. I want in column k to change the values according the values in column g
Please anybody can help with the following, it seems right to me but i doesn't do anything.
Private sub loopthrough() for i = 3 to 100 vartest = (Members.cells("G",i).value) Select case vartest case "15 DAYS" varresult = "31" case "1 MONTH" varresult = "50" case "3 MONTHS" varresult = "135" case "6 MONTHS" varresult = "235" case "12 MONTHS" varresult = "430" case "18 MONTHS" varresult = "615" case else varresult = "" end select Members.cells("K",i).formula = varresult Next i end sub
Last edited by teylyn; 08-22-2011 at 04:55 AM. Reason: added code tags
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
I'll add the code tags this time, but please remember to use them from now on.
Last edited by teylyn; 08-22-2011 at 04:54 AM.
This should work
What do you get?Private Sub loopthrough() For i = 3 To 100 vartest = (Members.Cells("G", i).Value) Select Case vartest Case "15 DAYS": varresult = 31 Case "1 MONTH": varresult = 50 Case "3 MONTHS": varresult = 135 Case "6 MONTHS": varresult = 235 Case "12 MONTHS": varresult = 430 Case "18 MONTHS": varresult = 615 Case Else: varresult = "" End Select Members.Cells("K", i).Value = varresult Next i End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks