• 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.

Help for vba code for a formula in two cells

Hi Friends,

I have a sheet where I need a formula(as below) to be inserted in the in column "B" and "C" using a vba code.

Column B = NETWORKDAYS(A2,$D$2)-1
Column C = =IF(B2>90,">90 Days",(IF(B2<6,"0-5 Days",IF(B2<31,"6-30 Days",IF(B2<91,"31-90 Days")))))

Attached sheet for your reference.

Data in column A and D will change every month.

Request your help on this.


upload_2016-2-6_17-40-12.png
 

Attachments

  • Sample Chandoo.xlsx
    119.1 KB · Views: 7
Should be something like
Code:
Sub test()
    Range("a2", Range("a" & Rows.Count).End(xlUp)).Offset(, 1).Resize(, 2).Formula = _
    Array("=NETWORKDAYS(A2,$D$2)-1", "=IF(B2>90,"">90 Days"",(IF(B2<6,""0-5 Days"",IF(B2<31,""6-30 Days"",IF(B2<91,""31-90 Days"")))))")
End Sub
 
Back
Top