Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2005

Tip: Looking for answers? Try searching our database.

Cell text manipulation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GR3G2K - 09 Jun 2005 10:01 GMT
My request should be fairly simple: I need to know where the content of a
cell (not format or anything else) is stored for being used in VBA. If I have
multiple cells selected, I want to know how to reference the content of each
one, and later apply some changes to each one in the selection.

Below is the practical application of what I'm trying to implement:

I'm creating a macro for some accountants and I need to get them to format
their tables correctly. If a cell contains a negative number, it appears in
brackets. The problem is, the comas from each cell won't align because
positive numbers don't use brackets, so the position of the comas on a colum
will vary.

All I want is a simple macro that, with multiple rows selected, after a
certain key combination, will add a blank space to the end of a positive
number and leave negative numbers untouched. I've been looking over it and
suppose it's down to using If clauses, so if the last char of the cell isn't
a ")", it will append a blank space (or empty char) to the end of the cell's
contents.

Thanks
Jean-Guy Marcil - 09 Jun 2005 13:47 GMT
GR3G2K was telling us:
GR3G2K nous racontait que :

> My request should be fairly simple: I need to know where the content
> of a cell (not format or anything else) is stored for being used in
[quoted text clipped - 16 lines]
> last char of the cell isn't a ")", it will append a blank space (or
> empty char) to the end of the cell's contents.

You do not need a macro for this.
Just apply a style that contains a decimal tab to the cells where you want
the decimal separator aligned. That is what the decimal tab was designed
for.

Spot the tab icon on the leftmost side of the horizontal ruler (A right
angle). Click on it until it becomes an upside-down "T" with a dot on the
right side.
Select the cell where you want this tab. Click on the ruler to insert the
tab at the position you want. Make sure that the cell is left aligned. Test
it with different numbers. Slide the decimal tab on the ruler until it is
set at the position you want. Then select the text in the cell and create a
style based on the selection. Finally, apply this style to all cells where
you want this behaviour.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.