Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel VBA PEM to get/set column FORMAT
Message
De
03/12/2005 10:53:58
 
 
À
03/12/2005 10:46:35
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01074459
Message ID:
01074587
Vues:
27
My first problem was that I could not name a range by "A:A" format, because I did not know which columns were involved from run-to-run.
TamarG came up with
            Set oRange = oSheet.Columns(xx + 1)
oRange.Insert (xlShiftToRight)
, which did the job nicely compared to cell-by-cell.
cheers, and thanks for the hints



>I see. Yes generally you need to know what you're seeking beforehand and what seems to be natural word to search is not the one:(
>"it was mcuh much better than the several hours the process would have taken if I continued to insert a column cell-by-cell, which was what I had been doing. That way, for my sheet of 6966 rows, each INSERT of a full column was taking 1hour 10minutes. So 5 minutes for the whole job was much much better." Well I might be a pain in the neck with this:)
>Are you sure it's the right way to do it? You say insert "full column" (and it's not your fault macros etc direct you insert()), then correct function is not insert() but EntireColumn.Insert.
>ie:
>
>ox = Createobject('Excel.Application')
>With ox
>  .Workbooks.Add
>  .Visible = .T.
>  With .ActiveWorkBook.ActiveSheet
>    .Range('A1:FA7000').Cells.Value = 'filled' && Columns A-FA,7000 rows are already have data
>    .Range("D:AV").EntireColumn.Insert && Insert full columns in range D-AV
>    .Range("E10:H50").Name = "myDataIsland" && Name a specific region
>    .Range("myDataIsLand").Select && Names provide a better means to refer to ranges
>  Endwith
>Endwith
>
>If this is not it, still you can use Insert() function selecting a big range and calling once.
>PS:Notice .Visible = .t. at top. Contrerary to popular belief it might be a reason for faster results (I myself was thinking I should make it visible when other operations are finished).
>Cetin
>
>
>>Hi Cetin,
>>
>>I am using the Help that is offered by the Help menu item when in "macro" code in Excel.
>>When I installed Office 2003 I installed everything, and it seems to offer 3 helps when I start it... VBA for Excel, VB, and VBA for Office.
>>
>>My problem seems to be that this object model is somewhat 'strange' and especially the terminologies do not match my thinking.
>>For example, When I searced on "Format" the property "NumberFormat" did appear somewhere in the list but I skipped it every time because it seemed specific to numbers and I wanted to format to various.
>>Strangely, too, when I search for some things it puts the thing in the middle of a long list of search results. And if I search for something like "For" it comes up with nothing.
>>I only ask on UT after much frustration < s >.
>>
>>As regards the 5 minutes... it was mcuh much better than the several hours the process would have taken if I continued to insert a column cell-by-cell, which was what I had been doing. That way, for my sheet of 6966 rows, each INSERT of a full column was taking 1hour 10minutes. So 5 minutes for the whole job was much much better.
>>
>>cheers
>>
>>
>>>>I've scoured as best I can the Help (and I complain about VFP's Help!!) and simply can't find what PEM is used for this.
>>>>
>>>>Any help much appreciated.
>>>>cheers
>>>
>>>Jim,
>>>You have the answer.
>>>What help are you checking? Normal excel F1 or that clip animation? If yes you wouldn't find anything usefull regarding to automation there. You need VBA help file. It needs to be installed (if you haven't done so in initial install) and name&location differs based on version. For example for excel10 it's:
>>>"C:\Program Files\Microsoft Office\Office10\1033\VBAXL10.CHM"
>>>In other versions location is almost the same, name something like VBAXLxx.chm or VBA_XLxx.hlp.
>>>PS: I remember I saw another post regarding excel and 5 mins you found fast:) When you proceed in Excel you'd notice it's sloooow. I expected the situation you describe to be done in few seconds (but didn't understand what exactly you were doing:).
>>>Cetin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform