Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 391
Default How to Dim the contents of a variable in running procedure?

2003/2007

fCount is a number of "Operators" in a Formula string
iCounter is the InStr() position of each operator in a Formula string

The variable which I wish to initiate is, temporariiy labeled, "Hold".

Hold = "Gap" & fCount & "Start" & "(" & iCounter & ")"

In my context, the contents of "Hold" is Gap4Start(13)

How do I Dim Gap4Start(13) in the midst of a running procedure?
i.e., Dim Gap4Start(13) as Long (So that, ? Gap4Start(13) is 13)

My goal is to be able to "address" each Gap?Start(x) and obtain the contents :

Or put differently: The character position of the start of a "Gap" in the fourth
cell reference in FormulaStr is 13

I hope that I have been clear.

TIA EagleOne
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How to Dim the contents of a variable in running procedure?

It sounds like you'd want to use this as an array so you could loop through the
formula string???

I think I'd use something like:

dim GapStart() as long


'later determine the number of operators in the formula string and then redim
that array variable.

fCount = 18 'say
redim gapstart(1 to 18)

'Then loop through the string assigning the starting positions to that array.

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iCounter
next ictr

The iCtr that I used counts through the number of elements in that array. Your
iCounter holds the starting points.

Those names would confuse me! I'd use a more meaningful name for the starting
position variable:

dim GapStart() as long
dim iStartingPos as long
dim iCtr as long
dim fCount as long

fCount = 18 'say
redim gapstart(1 to 18)

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iStartingPos
next ictr

=======



wrote:

2003/2007

fCount is a number of "Operators" in a Formula string
iCounter is the InStr() position of each operator in a Formula string

The variable which I wish to initiate is, temporariiy labeled, "Hold".

Hold = "Gap" & fCount & "Start" & "(" & iCounter & ")"

In my context, the contents of "Hold" is Gap4Start(13)

How do I Dim Gap4Start(13) in the midst of a running procedure?
i.e., Dim Gap4Start(13) as Long (So that, ? Gap4Start(13) is 13)

My goal is to be able to "address" each Gap?Start(x) and obtain the contents :

Or put differently: The character position of the start of a "Gap" in the fourth
cell reference in FormulaStr is 13

I hope that I have been clear.

TIA EagleOne


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 391
Default How to Dim the contents of a variable in running procedure?

Thank's Dave!

For my own edification, how does one initialize the contents of a variable as, in turn, another
Variable?

Dim X as String

X = Y & iCounter

? X

Y5 'All is fine until next step

Y5 = 18 'How do I do this when X is "Y5"?

Thanks



Dave Peterson wrote:

It sounds like you'd want to use this as an array so you could loop through the
formula string???

I think I'd use something like:

dim GapStart() as long


'later determine the number of operators in the formula string and then redim
that array variable.

fCount = 18 'say
redim gapstart(1 to 18)

'Then loop through the string assigning the starting positions to that array.

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iCounter
next ictr

The iCtr that I used counts through the number of elements in that array. Your
iCounter holds the starting points.

Those names would confuse me! I'd use a more meaningful name for the starting
position variable:

dim GapStart() as long
dim iStartingPos as long
dim iCtr as long
dim fCount as long

fCount = 18 'say
redim gapstart(1 to 18)

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iStartingPos
next ictr

=======



wrote:

2003/2007

fCount is a number of "Operators" in a Formula string
iCounter is the InStr() position of each operator in a Formula string

The variable which I wish to initiate is, temporariiy labeled, "Hold".

Hold = "Gap" & fCount & "Start" & "(" & iCounter & ")"

In my context, the contents of "Hold" is Gap4Start(13)

How do I Dim Gap4Start(13) in the midst of a running procedure?
i.e., Dim Gap4Start(13) as Long (So that, ? Gap4Start(13) is 13)

My goal is to be able to "address" each Gap?Start(x) and obtain the contents :

Or put differently: The character position of the start of a "Gap" in the fourth
cell reference in FormulaStr is 13

I hope that I have been clear.

TIA EagleOne

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 391
Default How to Dim the contents of a variable in running procedure?

BTW,

The solution that you provided, was exactly what I needed and so applied.

When I fooled around with ole' dBase IV code, there were different techniques to address a variable
vs the contents of that variable.


Dave Peterson wrote:

It sounds like you'd want to use this as an array so you could loop through the
formula string???

I think I'd use something like:

dim GapStart() as long


'later determine the number of operators in the formula string and then redim
that array variable.

fCount = 18 'say
redim gapstart(1 to 18)

'Then loop through the string assigning the starting positions to that array.

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iCounter
next ictr

The iCtr that I used counts through the number of elements in that array. Your
iCounter holds the starting points.

Those names would confuse me! I'd use a more meaningful name for the starting
position variable:

dim GapStart() as long
dim iStartingPos as long
dim iCtr as long
dim fCount as long

fCount = 18 'say
redim gapstart(1 to 18)

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iStartingPos
next ictr

=======



wrote:

2003/2007

fCount is a number of "Operators" in a Formula string
iCounter is the InStr() position of each operator in a Formula string

The variable which I wish to initiate is, temporariiy labeled, "Hold".

Hold = "Gap" & fCount & "Start" & "(" & iCounter & ")"

In my context, the contents of "Hold" is Gap4Start(13)

How do I Dim Gap4Start(13) in the midst of a running procedure?
i.e., Dim Gap4Start(13) as Long (So that, ? Gap4Start(13) is 13)

My goal is to be able to "address" each Gap?Start(x) and obtain the contents :

Or put differently: The character position of the start of a "Gap" in the fourth
cell reference in FormulaStr is 13

I hope that I have been clear.

TIA EagleOne

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How to Dim the contents of a variable in running procedure?

There are some languages that let you build a variable name and use that string
as the variable.

But excel's VBA isn't one of them.



wrote:

BTW,

The solution that you provided, was exactly what I needed and so applied.

When I fooled around with ole' dBase IV code, there were different techniques to address a variable
vs the contents of that variable.

Dave Peterson wrote:

It sounds like you'd want to use this as an array so you could loop through the
formula string???

I think I'd use something like:

dim GapStart() as long


'later determine the number of operators in the formula string and then redim
that array variable.

fCount = 18 'say
redim gapstart(1 to 18)

'Then loop through the string assigning the starting positions to that array.

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iCounter
next ictr

The iCtr that I used counts through the number of elements in that array. Your
iCounter holds the starting points.

Those names would confuse me! I'd use a more meaningful name for the starting
position variable:

dim GapStart() as long
dim iStartingPos as long
dim iCtr as long
dim fCount as long

fCount = 18 'say
redim gapstart(1 to 18)

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iStartingPos
next ictr

=======



wrote:

2003/2007

fCount is a number of "Operators" in a Formula string
iCounter is the InStr() position of each operator in a Formula string

The variable which I wish to initiate is, temporariiy labeled, "Hold".

Hold = "Gap" & fCount & "Start" & "(" & iCounter & ")"

In my context, the contents of "Hold" is Gap4Start(13)

How do I Dim Gap4Start(13) in the midst of a running procedure?
i.e., Dim Gap4Start(13) as Long (So that, ? Gap4Start(13) is 13)

My goal is to be able to "address" each Gap?Start(x) and obtain the contents :

Or put differently: The character position of the start of a "Gap" in the fourth
cell reference in FormulaStr is 13

I hope that I have been clear.

TIA EagleOne


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 391
Default How to Dim the contents of a variable in running procedure?

Dave, thanks for stopping my attempts to do just that.


Dave Peterson wrote:

There are some languages that let you build a variable name and use that string
as the variable.

But excel's VBA isn't one of them.



wrote:

BTW,

The solution that you provided, was exactly what I needed and so applied.

When I fooled around with ole' dBase IV code, there were different techniques to address a variable
vs the contents of that variable.

Dave Peterson wrote:

It sounds like you'd want to use this as an array so you could loop through the
formula string???

I think I'd use something like:

dim GapStart() as long


'later determine the number of operators in the formula string and then redim
that array variable.

fCount = 18 'say
redim gapstart(1 to 18)

'Then loop through the string assigning the starting positions to that array.

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iCounter
next ictr

The iCtr that I used counts through the number of elements in that array. Your
iCounter holds the starting points.

Those names would confuse me! I'd use a more meaningful name for the starting
position variable:

dim GapStart() as long
dim iStartingPos as long
dim iCtr as long
dim fCount as long

fCount = 18 'say
redim gapstart(1 to 18)

for iCtr = lbound(gapstart) to ubound(gapstart)
'something that determines that starting point
gapstart(ictr) = iStartingPos
next ictr

=======



wrote:

2003/2007

fCount is a number of "Operators" in a Formula string
iCounter is the InStr() position of each operator in a Formula string

The variable which I wish to initiate is, temporariiy labeled, "Hold".

Hold = "Gap" & fCount & "Start" & "(" & iCounter & ")"

In my context, the contents of "Hold" is Gap4Start(13)

How do I Dim Gap4Start(13) in the midst of a running procedure?
i.e., Dim Gap4Start(13) as Long (So that, ? Gap4Start(13) is 13)

My goal is to be able to "address" each Gap?Start(x) and obtain the contents :

Or put differently: The character position of the start of a "Gap" in the fourth
cell reference in FormulaStr is 13

I hope that I have been clear.

TIA EagleOne

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
Multiplying the contents of two cells a variable number of times Stephen Brown Excel Worksheet Functions 1 September 6th 06 09:22 AM
Urgent help on VBA Procedure Jeff Excel Discussion (Misc queries) 0 May 25th 06 02:23 PM
VBA Procedure Jeff Excel Discussion (Misc queries) 0 January 20th 06 04:22 PM
Very Urgent VBA Procedure Jeff Excel Discussion (Misc queries) 0 October 5th 05 05:39 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM


All times are GMT +1. The time now is 09:10 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"