Solved

Format and Justify FlexGrid Cells

Posted on 2004-04-02
5
868 Views
Last Modified: 2006-11-17
Hi Experts,
  I am using a Flex Grid that has text in the first column and then numbers in the rest of the columns.  There are two rows of headers as well.  My problem is that sometimes the numbers will be in dollars, sometimes in percent, sometimes just a plain number, and occasionally it will actually be TEXT.  I need them to be formatted correctly based on info from an array that I have AND I need all columns (other than the first column and except for the first two rows) to be right justified regardless of whether it's a number or text.  How can I accomplish this?
  Why is it that the flexgrid puts all numbers right justified and then text left justified if everything in a flex grid is text anyway??
Thanks in advance for the help!
-Ren
0
Comment
Question by:Ren
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Xentor_
ID: 10743121
For idx = 1 to flex.Cols.Count - 1
  flex.ColAlignment(idx) = flexAlignRightCenter
Next idx

That'll right-justify everything except the first column.  I don't remember if it affects fixed rows, but you can always specifically set the alignment of the first two rows to something else.
0
 
LVL 3

Accepted Solution

by:
santosh26676 earned 500 total points
ID: 10756941
I think You need to first set the alignment for all the cols (except first) to right and then modify the individual cells of the first two rows to set the alignment to center.

0
 

Author Comment

by:Ren
ID: 10775246
Good call santosh, that was quick and easy!  After a bit of research, I found that MSFlexgrid.ColAlignment(intCTR) = flexAlignRightCenter worked well.
-Ren
0
 

Author Comment

by:Ren
ID: 10775289
santosh,
I went ahead and gave you the points, I was trying to catch up on a few open questions and forgot about the main part of this question.  I don't suppose you know how to format individual cells in currency, 000's or percent, do you?
-Ren
0
 
LVL 3

Expert Comment

by:santosh26676
ID: 10780774
Yes I can answer your next question too. but will I get some more point.

Just Kidding!! I will send you the code to do this.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question