C
cutthroatjess
In another sub, this works just fine! The only difference is that I have it
select a different sheet and do the same thing.
This is failing on : Print #3, Trim(Cells(l, 1)) 'sample id
saying that there is an application-defined or object-defined error.
Sometimes it says the file is already open.
OK Here's my code:
Public Sub cations()
Dim l, m, n As Integer
Sheets("cations").Select
Open "c:\textfiles\postmcrocations.txt" For Output As #3
Open "c:\textfiles\temp\postmcrocations.tmp" For Output As #4
For l = Cells(2, 17) To Cells(2, 18)
'header info
Print #3, Trim(Cells(l, 1)) 'sample id
Print #4, Trim(Cells(l, 1))
Print #1, "$cations" 'multicomponent
Print #1, "6" 'number of analytes
For m = 2 To 7
n = m + 7
Print #1, Trim(Cells(1, m)) 'analyte name
Print #1, Trim(Cells(l, m)) 'analyte value
Print #1, Trim(Cells(l, n)) 'chromatagram location for
secondary result)
Next m
Next l
Close #3
Close #4
End Sub
Thanks!
Jesse
select a different sheet and do the same thing.
This is failing on : Print #3, Trim(Cells(l, 1)) 'sample id
saying that there is an application-defined or object-defined error.
Sometimes it says the file is already open.
OK Here's my code:
Public Sub cations()
Dim l, m, n As Integer
Sheets("cations").Select
Open "c:\textfiles\postmcrocations.txt" For Output As #3
Open "c:\textfiles\temp\postmcrocations.tmp" For Output As #4
For l = Cells(2, 17) To Cells(2, 18)
'header info
Print #3, Trim(Cells(l, 1)) 'sample id
Print #4, Trim(Cells(l, 1))
Print #1, "$cations" 'multicomponent
Print #1, "6" 'number of analytes
For m = 2 To 7
n = m + 7
Print #1, Trim(Cells(1, m)) 'analyte name
Print #1, Trim(Cells(l, m)) 'analyte value
Print #1, Trim(Cells(l, n)) 'chromatagram location for
secondary result)
Next m
Next l
Close #3
Close #4
End Sub
Thanks!
Jesse