Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Dynamic Values in Procedure

See one more suggestion at your other post.

bw wrote:

I have the following procedure, and it works as it should.

Sub OPENTHEFILE()
Workbooks.OpenText Filename:="C:\DownLoads\LAS6014", Origin:=437, StartRow _
:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(Range(DA(2, 0)), Range(DA(2, 1))), _
Array(Range(DA(3, 0)), Range(DA(3, 1))), _
Array(Range(DA(4, 0)), Range(DA(4, 1))), _
Array(Range(DA(5, 0)), Range(DA(5, 1)))), _
TrailingMinusNumbers:=True
End Sub

Now I want to obtain a value for the DA array from my worksheet indicating how many
fields there will be, and then loop through the OPENTHEFILE procedure depending on
the number of fields.

So I'm looking for something like the following (although I KNOW the following is NOT
correct):

Sub OPENTHEFILE()
Workbooks.OpenText Filename:="C:\DownLoads\LAS6014", Origin:=437, StartRow _
:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
For x = 0 To VariableFromWorksheet
Array(Range(DA(x, 0)), Range(DA(x, 1))), _
Next x
TrailingMinusNumbers:=True
End Sub

Something like that! I hope you get the idea...

Can anyone help?

Thanks,
Bernie


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Sum last 10 values of a dynamic column excluding zero Morgan Excel Discussion (Misc queries) 0 April 20th 10 06:00 AM
Stop a Procedure from another procedure Ayo Excel Discussion (Misc queries) 1 October 30th 08 01:42 AM
Dynamic Range of Cell Values in a single Row KarenB Excel Discussion (Misc queries) 5 October 12th 06 09:11 PM
simplify procedure to get rid of 0 error values in a spreadsheet Frederic Excel Worksheet Functions 1 February 8th 06 04:47 AM


All times are GMT +1. The time now is 02:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"