[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Creating a formula to put in a spreadsheet created with VB.net

Posted on 2006-03-20
4
Medium Priority
?
241 Views
Last Modified: 2010-04-23
Friends

Okay, I have the following For loop, and I need to calculate the following value, but I don't have a clue...

What I want is:

K4 = ( H4 - ( I4 + J4 ) )
K5 = ( H5 - ( I5 + J5 ) )
K6 = ( H6 - ( I6 + J6 ) )
K7 = ( H7 - ( I7 + J7 ) )
...
K26 = ( H26 - ( I26 + J26 ) )

Known:

Number of Cars = 23
I Column has an integer value of 8
H Column has an integer value of 9
J Column has an integer value of 10
K Column has an integer value of 11

Now here is the for loop

        CarNumberPositionCounter = 0
        For CheckAmountCounter As Integer = 1 To NumberOfCars

            CellRow = 3 + CheckAmountCounter
            Dim CellColumn2 As Integer = 11

            oSheet.Cells(CellRow, CellColumn2).Value = (oSheet.Cells(CellRow, 8) - (oSheet.Cells(CellRow, 9) + oSheet.Cells(CellRow, 10))) 'This doesn't work, but you get the idea
            CheckAmountCounter += 1

        Next
0
Comment
Question by:indy500fan
  • 2
4 Comments
 
LVL 10

Assisted Solution

by:bchoor
bchoor earned 750 total points
ID: 16242550
did u try it by including the value property

e.g
oSheet.Cells(CellRow, 8).Value - (oSheet.Cells(CellRow,9).Value + oSheet.Cells(CellRow, 10).Value)

HTH
~BC
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 750 total points
ID: 16243246
Wouldn't it be just as effective to let Excel do that, with a formula in a cell?

Bob
0
 

Author Comment

by:indy500fan
ID: 16259462
Bob,

I think this is what you are talking about...

        oRng = oSheet.Range("K4", "K" & NumberOfCars + 3)
        oRng.Formula = "=H4 - (I4+J4)"

This is what I used to make it work...

bchoor, I didn't try it because I figured out the solution above, but...If you think it'll work, I'll give you the points.

Regards,
Eric
0
 

Author Comment

by:indy500fan
ID: 16279892
Since you guys responded, but I haven't heard back I'll split the points.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question