Question: If J 6 is selected, the following code checks if the value in J 1 2 is 0 - 3 3 0 , if so

If J6 is selected, the following code checks if the value in J12 is 0-330, if so, it populates S1 in J18 and divides the value in J14 by 360. If the value in J12 is 331-500, it populates S1 in J18 and it divides the value in J14 by 240. If the value in J12 is 500-600, it populates S2 in J18 and it divides the value in J14 by 180. If the value in J12 is 661-1000, it populated S2 in J18.
If cs.Range("J6")="DC" Then
If cs.Range("J12")>=0 And cs.Range("J12")<=330 Then
cs.Range("J18")="S1"
cs.Range("J20")= Application.WorksheetFunction.Ceiling(cs.Range("J14")/360,1)
ElseIf cs.Range("J12")>=331 And cs.Range("J12")<=500 Then
cs.Range("J18")="S1"
cs.Range("J20")= Application.WorksheetFunction.Ceiling(cs.Range("J14")/240,1)
ElseIf cs.Range("J12")>=500 And cs.Range("J12")<=660 Then
cs.Range("J18")="S2"
cs.Range("J20")= Application.WorksheetFunction.Ceiling(cs.Range("J14")/180,1)
ElseIf cs.Range("J12")>=661 And cs.Range("J12")<=1000 Then
cs.Range("J18")="S2"
cs.Range("J20")= Application.WorksheetFunction.Ceiling(cs.Range("J14")/120,1)
End If
Edit the code to implement the following
For S1:
If value in J12 is 0-330 and if J12 times J14 is more than 120000 then divide J14 by 360. If value in J12 is 331-500 if J12 times J14 is more than 120000 the divide J14 by 240. Otherwise, if J12 times J14 is than less than 120000 divide J14 by 360.
For S2:
If value in J12 is 500-660 and if J12 times J14 is more than 120000 then divide J14 by 180. If value in J12 is 661-1000 if J12 time J14 is more than 120000 the divide J14 by 120. Otherwise, if J12 times J14 is than less than 120000 divide J14 by 180.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!