Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

[RESOLVED] taking values away from each other

$
0
0
hi

i read in values from an excel spread sheet like this
Code:

        oRng = oWSSheet.Cells.Find("CASH (12000000)", , _
              Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, _
              Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False)
        ' MsgBox("Value '" & oRng.Value & "' found at '" & oRng.Address)
        Me.cash1 = oRng.Offset(0, 5).Value
        oRng = Nothing

        oRng = oWSSheet.Cells.Find("Cash at Bank - URGL", , _
      Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, _
      Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False)
        ' MsgBox("Value '" & oRng.Value & "' found at '" & oRng.Address)
        Me.cash2 = oRng.Offset(0, 5).Value


        oRng = Nothing

and display them in another spreadsheet using this
Code:

oBook.Worksheets(1).Cells(30, 3).value = _cash1
now what i want to do is take the value from the first block of code and take it away from the second one and display it in the spreadsheet but can seem to get it working.
was trying something like this but it doesnt work
Code:

Me.Cash = Me.cash1 = oRng.Offset(0, 5).Value - Me.cash2 = oRng.Offset(0, 5).Value
anyone any ideas how to get the value when they are taken away

Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>