1. combining IF...THEN statements question

ok...I feel like an **** asking this question because it is probably a simple answer...the problem is I am not a developer and can't even play one on TV. I have a script that reads an excel spreadsheet and then compares that record to a lineArray. The problem comes in here. We are now moving to the new year so the spreadsheet has changed. I have two statements here but i really need to combine them into one..and I need to add an IF THEN statement because if I check Plan Code 2007 if "NA" then check Plan Code 2008 then compare the 2008 Rider Code…if there was a value in Plan Code 2007 then compare Rider Code 2007...any help would be greatly appreciated since I have to move this logic to 5 or 6 different scripts.
'check rider code 1

planCnt = Ubound(planArray, 3)
For j = 0 to (planCnt - 3)
if (lineArray(i,12) = planArray(j,0)) Then 'compare 2007 plan codes
If planArray(j,2)="N/A" Then
planArray(j,2)=""
End If
If (lineArray(i,18) &lt;&gt; planArray(j,2)) Then 'compare 2007 rider codes
reporter.ReportEvent micFail, "Rider Code check", lineArray(i,17) &amp; " : " &amp; planArray(j,2) 'lineArray(i,17) &amp; " did not match according to the plan code " &amp; lineArray(i,12)
If planArray(j,2)="" Then
planArray(j,2)="N/A"
End If
Call writeExcel(hcnt + k,19,planArray(j,2),"fail",objExcel,objSheet)
Exit For
Else
Call writeExcel(hcnt + k, 19, planArray(j,2), "pass", objExcel, objSheet)
Exit For
End if
-----------------------------------------------------------------------------------------------------------
For j = 1 to (planCnt - 3)
if (lineArray(i,12) = planArray(j,1)) Then 'compare 2008 plan codes
If planArray(j,3)="N/A" Then
planArray(j,3)=""
End If
If (lineArray(i,18) &lt;&gt; planArray(j,3)) Then 'compare 2008 rider codes
reporter.ReportEvent micFail, "Rider Code check", lineArray(i,18) &amp; " : " &amp; planArray(j,3) 'lineArray(i,18) &amp; " did not match according to the plan code " &amp; lineArray(i,12)
If planArray(j,3)="" Then
planArray(j,3)="N/A"
End If
Call writeExcel(hcnt + k,19,planArray(j,3),"fail",objExcel,objSheet)
Exit For
Else
Call writeExcel(hcnt + k, 19, planArray(j,3), "pass", objExcel, objSheet)
Exit For
End if

'''''''open excel file that contains the report
Dim objExcel,objSheet,intRow,intcol, cnt, city, mcnt
Dim fso, fldr, myPath
Dim fileArray()
i=1
j=1
k=0
'''open sheet that contains plan numbers and rider codes
ReDim planArray(planRows-1,3) 'first 2 dimensions contains plan codes, last 2 dimensions contains ridercodes

For i=3 to planRows
planArray(i-3,0)=objSheet.Cells(i,7)
planArray(i-3,1)=objSheet.Cells(i,8)
planArray(i-3,2)=objSheet.Cells(i,17)
planArray(i-3,3)=objSheet.Cells(i,18)
Next

Thank you for any help you can give forum members and forgive me.

2. Re: Scripting help NEEDED

First you are not following forum guidelines:

1. Your generic title should summarize your problem, so that searching will be useful

2. Please do not SCREAM in capital letters when posting your title.

Second, it is not realistic to cut/paste a big blob of code and ask folks to find your problem(s). For that you probably need to hire a consultant to be your learning mentor.

So....

2. Cut this post down to the essential problem area and the ask one or two specific questions that are stumping you in that section of the code.

3. Then, re-title the thread to match those logically associated questions.

-Terry Horwath

3. combining IF...THEN statements

I apologize for my lack of forum etiquette...this is normally not my area. I attached both statements that i want to combine...I was unsure of what was needed to I gave it all.

4. Re: combining IF...THEN statements

Actually you have given too much of code for some one to be able help. You should break down the problem into smaller parts and give a simpler example on what is required.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.