New Reply

Fortran code conversion into Excel VBA

 
Share Thread Thread Tools
Jul16-12, 10:23 PM   #1
 

Fortran code conversion into Excel VBA


Hi,

I'm currently working on a project that requires me to convert a Fortran code into excel vba.
There are some problems that I've stumbled into, so itll be great if someone could help out.

one of it would be on how to convert a COMMON statement in Fortran to Excel VBA ( as in how would the coding be??) the coding is below:


IMPLICIT REAL*8 (A-H,O-Z)
REAL*8 C2X,C3X
REAL*8 KR1E,KR2E,M,N
COMMON /INFSVE/ PRES,TRES,SALN,FOINIT,DENC,ZC,YKSVE,SCSVE
COMMON /FLSH/ S(2),C(3,2),XK(3)
COMMON /PROP/
+ SWC(6), VWC(6), CWC(6), SLW(4), SFC(4),
+ TVC(5), PVC(6), VCO2(5,6),
+ TDC(5), PDC(7), DCO2(5,7),
+ TSC(5), PSC(6), SCO2(5,6),
+ TZC(7),PZC(19), ZCO2(7,19),
+ TBW(9),BWC(15), RHO(9,15)

Is the SWC and the others after it arrays??

hope there's someone to help me out here. thanks
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Galaxies fed by funnels of fuel
>> The better to see you with: Scientists build record-setting metamaterial flat lens
>> Google eyes emerging markets networks
Jul17-12, 02:31 PM   #2
 
Recognitions:
Homework Helper Homework Help
I'd just define them as global variables. Global variables should be described in whatever reference material you are using to learn VBA.
Jul17-12, 04:29 PM   #3
 
Mentor
Yes, SWC and the other variables listed after it are arrays, as areS, C, and XK. C is a two-dimensional array, with 3 rows and 2 columns.
Jul18-12, 03:55 AM   #4
 

Fortran code conversion into Excel VBA


thanks.

so if thats the case before the subroutine in vba should i declare it as a GLOBAL file?? where then the arrays will be available to all subroutines in the module.
Jul18-12, 03:58 AM   #5
 
Another doubt that I'm having would be the WRITE statements

for example:

IF(POROS.LE.0.0)WRITE (NOT1,9600)ICHK
IF (PERM.LE.0.0)ICHK=3

Looking at the fortran code, is the WRITE statement equivalent to writing on file NOT1 and then skipping to line 9600.

if so can i define line 9600 in VBA as follows:

9600:

(and then put in the required coding into the line)


hope u guys can help me out.thanks
New Reply
Thread Tools


Similar Threads for: Fortran code conversion into Excel VBA
Thread Forum Replies
fortran code Engineering, Comp Sci, & Technology Homework 1
How To Run Fortran.exe using Excel Programming & Comp Sci 2
Sort an excel sheet by VB code Programming & Comp Sci 0
Convert latex code to fortran code? Math & Science Software 1
excel code Computing & Technology 1