Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attachmate & Excel question, short

Status
Not open for further replies.

afortuna98

Programmer
Apr 4, 2014
28
US
Excel 2010 can handle up to 64 nested IF statements in a single line. Can the same be said for Attachmate? As an example, can I have a macro look at a specific location and based off the corresponding text run a specific action. As an example, 22 letters of the alphabet, can the macro look at a specific location, determine the letter, then based off and IF Statement, do a specific action dependent on that letter? Yes or no would be good at this point, so I can attempt it on my own if possible. Thanks guys.
 
hi,

Excel formulas and VBA are two different animals.

If you were coding in Excel VBA, a Cadillac compared to the Attachmate Yugo, you could use the Select Case ... End Case statement structure.

But in Attachemate VB, just use If ... Else ... End If and nest them.

I'd strongly urge you to Block Indent your structures and this is how I'd start with a complete block
Code:
    If x = x Then

    Else
    
    End If
...and then start filling in the blanks: first the expression, then the statements to execute for TRUE, then FALSE. If there's no Else (FaLSE) then just delete those lines. Pre coding your block structures, For ... Next, Do ... Loop, With ... End With etc, keeps you from forgetting the struff that your compiler with bite you for.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
skip, why not use Select Case...End Select with attachmate? it seems so much easier

rem
 
I did not see select case in my extra basic help reference.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 

I rarely code in Atachmate VB. Most of my codeing is in Excel VBA. And as it happened, my Extra VB Help did not reference the Select Case structure.

Select Case is probably the best approch for " 22 letters of the alphabet"
Code:
[b]'all declarations at head of code module[/b]
    Dim s As String
'...... statements that follow declarations
   
    Select Case s
        Case "A"
            'this is what happens
            'when this value is
            'in the Case expression
        Case "B"
            'this is what happens
            'when this value is
            'in the Case expression
        Case Else
            'this is what happens
            'when this value is
            'none of the values
            'in the Case expression
    End Select

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top