Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to Format Variables Correctly
#1
Not Solved
I am comparing two sorted excel files "acct" and "Crystal" and merging there contents into a third. I sorted the two excel files on two common fields in each. - Account number and and amount. I am trying to compare these two fields to see if there are differences between the two excel files, but the format I am getting is not the same that was use to sort the columns in the excel files. I would like the amount fields fixed and the account field to have leading zeroes so that the compare determines if there if found an extra accouting or crystal records and increments accordingly.

The amount field shows 0000001924.00 in excel, but the variable that I assigned from the cell had "1924". The Account field has leading zeroes and shows as such in excel, but the var does not have a leading zero. Can this be done or should I approach this problem differently?
Code:
Do until EndofBothFiles = true
    sAcctCustNBR= xlSheet.Rows(iARow).Columns(8)
    sCrystalCustNBR = xlSheet3.Rows(iCRow).Columns(8)
    sAcctAmount = xlSheet.Rows(iARow).Columns(2)
    sCrystalAmount = xlSheet3.Rows(iCRow).Columns(7)
    sAcctKey = sAcctCustNBR & sAcctAmount
    
    If sAcctKey = sCrystalKey Then
           'Move accounting and crystal fields to new speadsheet            
       iARow = iARow+1
       iCRow = iCRow+1
       iRow = iRow+1
    elseif sAcctKey < sCrystalKey  Then
      ' move accouning fields to new spreadsheet
       iARow = iARow+1
             iRow = iRow+1
    else
       'move crystal fields to new spreadsheet
       iCRow = iCRow+1
             iRow = iRow+1
    End If
    If iARow >= iAcctRowCount and iCRow >= iCrystalRowCount Then
       EndofBothFiles=True
    End If
Loop
Reply


Messages In This Thread
Need to Format Variables Correctly - by MichaelS - 11-15-2011, 12:56 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP11.0 - Date format is changed as text while executing the QTP script. Automation Tester 1 4,122 05-30-2014, 01:25 PM
Last Post: Tarik Sheth
  QTP 11 - GetVisibleText not getting text correctly in windows7 from Activex Pallavi 1 5,905 03-14-2014, 02:47 PM
Last Post: venkatesh9032
  where to declare variables?? ACCBAJPA 0 2,373 10-01-2013, 07:20 PM
Last Post: ACCBAJPA
  Validate Numeric value is displaying expected format kalaivanan123 1 3,508 09-23-2013, 08:45 PM
Last Post: ravi.gajul
  Break up a string of text and variables csutter2002 3 3,617 03-20-2013, 06:58 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)