Solved

Format and Justify FlexGrid Cells

Posted on 2004-04-02
5
859 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now