Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding the far-right column in excel
Message
De
01/10/2002 20:57:12
 
 
À
01/10/2002 16:00:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00705926
Message ID:
00706662
Vues:
19
Absolutely right. I know UsedRange only gives you the 'Used Range', but the truth is the ramifications of it never even entered my mind in my reply to you.

Just one of those considerations, I guess, that doesn't bubble up to the surface when the problem isn't one of my own sitting in front of me.

Nice catch.

Alan

>Hi Alan,
> One additional word of warning on this. If the first column that has data is NOT the first column in the sheet then that code won't work exactly right. For example, if column 1 is empty, and columns 2 - 10 have data, then num_cols would return 9, and this_row would be "a1:i1" when what you really wanted was "b1:j1".
> Using o.Application.ActiveSheet.UsedRange.Column will return the value of the first USED column in your excel sheet. Therefore your 'this_row' variable would become:
>
>begin_col= o.Application.ActiveSheet.UsedRange.Column
>this_row = chr( 97 + begin_col - 1 ) + "1:" + chr( 97 + begin_col - 1 + num_cols - 1) + "1"
>
>However, if you're sure your data will always begin in column 1, this point does not matter.
>
>Happy Excelling.
>
>>Alan, Thanks Steve
>>its
>>num_cols = o.Application.ActiveSheet.UsedRange.Columns.Count
>>this_row = "a1:"+chr( 97 + num_cols -1)+"1"
>>o.Application.Range(this_row).Select
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform