• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Can someone help me out with looping process

Shailender

Member
I want to do some calculations like rank function and Count if and Concatenate, Please refer to the cells I1:I3 in the attached excel sheet. And for the code please refer to the module. And also highlighted the area with green color were the looping should take place.

Thanks in advance
 

Attachments

  • Looping.xlsm
    19.2 KB · Views: 6
There is no need to loop .. Try the code
Code:
Sub Test()
    Range("I1").Formula = "=CONCATENATE(""["",I2,""/"",I3,""]"")"
    Range("I2").Formula = "=RANK(I13,I9:I14)"
    Range("I3").Formula = "=COUNTIF(I9:I14,"">0"")"
   
    Range("I1:I3").AutoFill Destination:=Range("I1:AF3"), Type:=xlFillDefault
    Range("I3").CurrentRegion.Value = Range("I3").CurrentRegion.Value
End Sub
 
…or add .resize(,24) to each of the three .Formula lines:

ActiveCell.Resize(, 24).Formula = "=rank(" & Newcell & "," & StrColum & ":" & EndColum & ")"

ActiveCell.Resize(, 24).Formula = "=Countif(" & StrColum & ":" & EndColum & "," & """>0""" & ")"

ActiveCell.Resize(, 24).FormulaR1C1 = "=CONCATENATE(""["",R[1]C,""/"",R[2]C,""]"")"
 
Back
Top