View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
bw bw is offline
external usenet poster
 
Posts: 74
Default Programming a current procedure

Dave!

I wrote you a thank you note yesterday, but now I don't see it listed. But I'll say thanks
again. You were able to understand my mumblings about this problem and provide me
with exactly what I was looking for.

Again, thank you very much..

Bernie


On Fri, 18 Jul 2003 20:44:10 -0500, Dave Peterson wrote:
Maybe you could even build the array of arrays:

Option Explicit
Sub testme()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet
Dim myArray As Variant

Set wks = Worksheets("sheet1")

With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
ReDim myArray(FirstRow To LastRow)
For iRow = FirstRow To LastRow
myArray(iRow) = Array(.Cells(iRow, "A").Value, _
.Cells(iRow, "B").Value)
Next iRow
End With

Workbooks.OpenText Filename:="C:\DownLoads\LAS6014", Origin:=437, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=myArray, _
TrailingMinusNumbers:=True

End Sub

I use A1 through the last used row in column A.




bw wrote:

Thank you, Tom!

I THINK I understand what you've suggested. If not, I'll ask again later.

Bernie

On Fri, 18 Jul 2003 12:57:53 -0400, "Tom Ogilvy" wrote:
You would need to put the numbers alone in cells
A1: 0
B1: 1
A1: 34
B1: 1


FieldInfo:=Array(Array(Range("A1"),Range("B1")),Ar ray(Range("A1"),Range("B2"
)))

demoing from the immediate window:

varr = Array(Array(Range("A1"),Range("B1")),Array(Range(" A2"),Range("B2")))
? varr(0)(0)
1

? varr(0)(1)
0

? varr(1)(0)
34

? varr(1)(1)
1


Regards,
Tom Ogilvy


"bw" wrote in message
...
Consider the following procedu

Sub LASMACRO()
Workbooks.OpenText Filename:="C:\DownLoads\LAS6014", Origin:=437,
StartRow _
:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1),
Array(34, 1), Array _
(64, 1), Array(68, 1), Array(69, 1), Array(70, 1), Array(75, 1),
Array(81, 1), Array( _
85, 1), Array(90, 1), Array(95, 1), Array(100, 1), Array(110, 1)),
_
TrailingMinusNumbers:=True
End Sub

On my spreadsheet, I have a column that includes the values for this
procedure. For
example,
Cell A1 = "Array(0,1)"
Cell A2 = "Array(34,1)"
Cell A3 = "Array(64,1)"
etc.

What I'd like to do is to modify the cells in column A on my spreadsheet,
and have these
changes be incorporated into the values for LASMACRO above.

If you understand the problem as I have stated it, can someone suggest a
method on
how to proceed?

Thanks,
Bernie





--

Dave Peterson