|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Linking Excel and VB
I have data (numbers in tabular form in an excel sheet. I want VBA to pick these numbers from Excel and use them as coefficients of an equation. This equation has to be displayed in a text file.
Example: Data in Excel sheet: 2 5 6 3 6 9 4 9 7 To be displayed in equation form in the text file: 2a + 5b + 6c + 3d + 6e + 9f + 4g + 9h + 7i = Z I would be greatful if somebody can write a code for this problem. Thanks, Jasdeep |
|
#2
|
|||
|
|||
|
put the following VBA code into a module in your excel file:
Sub Macro1() ' ' Macro1 Macro ' Macro recorded 10/26/2004 by User ' ' Dim a a = Sheet1.Cells(1, 2) & "a +" & Sheet1.Cells(1, 3) & "b +" Open "c:\TESTFILE.text" For Output As #1 Print #1, a Close #1 End Sub This shows the principle involved in addressing the individual cells of the spreadsheet (Sheet1) and how to open a text file, write to it then close it. There are probably more elegant ways to do this but this did work when I tried it. Maybe this will get you started. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Linking Excel and VB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|