Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Format for underlining a cell

Ok, I have a problem that I am trying to solve. Range("D3") has the
number 2004. The width of column D is 30. I need to keep the number
2004 as a number not as a text value. If I keep it as a number then
underline the cell using the single accounting underline it only
underlines the number. I want the number accross the majority of the
cell. Similar to using a word table and using the single line
underline in "paragraph" not cell. To show what I am looking for you
can just change the 2004 to be text instead of a number and the line
will be exactly what I am looking for. Is there any way to use VBA to
create an underline that goes across almost all of the cell. I want to
have a little space so when I use the underline across multiple columns
it is not a connected line.

Thanks in advance.
Will

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Format for underlining a cell

I don't think there is such a capability.

I would use the bottom border on that cell, then insert narrow blank columns
on each side of this column ti achive the gap (assumes you have turned off
gridlines).

--
Regards,
Tom Ogilvy


" wrote:

Ok, I have a problem that I am trying to solve. Range("D3") has the
number 2004. The width of column D is 30. I need to keep the number
2004 as a number not as a text value. If I keep it as a number then
underline the cell using the single accounting underline it only
underlines the number. I want the number accross the majority of the
cell. Similar to using a word table and using the single line
underline in "paragraph" not cell. To show what I am looking for you
can just change the 2004 to be text instead of a number and the line
will be exactly what I am looking for. Is there any way to use VBA to
create an underline that goes across almost all of the cell. I want to
have a little space so when I use the underline across multiple columns
it is not a connected line.

Thanks in advance.
Will


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Format for underlining a cell

This is an excellent question.

Enter 2004 in a cell and center it so empty space is on either side.

Then pull-down Format Cell Number Custom

and in place of General enter " "General" "

Then format as underlined. You will notice that the underlining includes
the spaces to the right and left of the number.

Adjust the number of spaces between the double quotes to get the desired
appearance for your font and column width
--
Gary's Student


" wrote:

Ok, I have a problem that I am trying to solve. Range("D3") has the
number 2004. The width of column D is 30. I need to keep the number
2004 as a number not as a text value. If I keep it as a number then
underline the cell using the single accounting underline it only
underlines the number. I want the number accross the majority of the
cell. Similar to using a word table and using the single line
underline in "paragraph" not cell. To show what I am looking for you
can just change the 2004 to be text instead of a number and the line
will be exactly what I am looking for. Is there any way to use VBA to
create an underline that goes across almost all of the cell. I want to
have a little space so when I use the underline across multiple columns
it is not a connected line.

Thanks in advance.
Will


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Format for underlining a cell

Thanks Gary's Student. I see what you are doing, but now my question
is: Is there a way to code it in VBA so that it automatically adjusts
the spaces to the width of the column? I'm assuming that there is some
ratio of characters per column width but I am just curious how to do it
in VBA. I basically am just creating an underline toggle that scrolls
through a few different options as far as color/thikness etc...


Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Format for underlining a cell

The technique is easy. In any instance we know the LEN() of the number in
the cell. We we can make a string array:

" ", " ", " "
etc.

Based upon LEN, we choose either more or less blanks.

The trick is that the number of blanks we need will vary by font. A litttle
experimentation will show you that numbers in Verdana will need less blanks
than numbers in Arial Narrow.

A worse problem applies to words (as opposed to numbers) if proportional
fonts are used.

--
Gary''s Student


" wrote:

Thanks Gary's Student. I see what you are doing, but now my question
is: Is there a way to code it in VBA so that it automatically adjusts
the spaces to the width of the column? I'm assuming that there is some
ratio of characters per column width but I am just curious how to do it
in VBA. I basically am just creating an underline toggle that scrolls
through a few different options as far as color/thikness etc...


Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Format for underlining a cell

I don't think it is as easy as you do. I understand how to get the
length of the number that is in the cell, but what is more important to
me is that when I toggle the underline it uses enough spaces to take up
95% of the cell. It needs to be consistent so that I can use it just
as easily between cells that are 10 wide or 30 wide. I hope I am
explaining myself correctly.

Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you apply double underlining? Tina Excel Discussion (Misc queries) 5 December 19th 09 05:50 PM
Financial Underlining Mervyn Thomas[_2_] Excel Discussion (Misc queries) 0 December 8th 09 05:37 PM
Underlining in Excel 2003 BillVa Excel Discussion (Misc queries) 1 April 1st 08 11:03 PM
How do I undue column and row underlining? sirsoto Excel Discussion (Misc queries) 1 December 2nd 05 09:15 PM
Lines or underlining ED New Users to Excel 1 March 29th 05 05:21 PM


All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"