Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Has Text Enough Space in a cell

Hello,

I would like to test if myValue has enough space (place) to be written in a
cell.

I know the width of my cell with

Set selected_cell = Target.Cells(1, 1)
Debug.Print selected_cell .Width

What is the width of the value?

Dim myValue as string
myValue = "a value from database"

selected_cell.value = myValue

Reason: I would like that the whole value has place in the cell, otherwise I
would shorten the value.

I need A function like width(cell, myValue) this depends on the font in the
cell
Any Hints

Thanks
Marcel


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Has Text Enough Space in a cell

I find it simpler to use Autofit.


"Marcel" wrote in message
...
Hello,

I would like to test if myValue has enough space (place) to be written in
a cell.

I know the width of my cell with

Set selected_cell = Target.Cells(1, 1)
Debug.Print selected_cell .Width

What is the width of the value?

Dim myValue as string
myValue = "a value from database"

selected_cell.value = myValue

Reason: I would like that the whole value has place in the cell, otherwise
I would shorten the value.

I need A function like width(cell, myValue) this depends on the font in
the cell
Any Hints

Thanks
Marcel




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
Wildcard for space text space pattern LuisE Excel Programming 5 October 28th 08 05:19 PM
deleting space in cell behind text RickJB Excel Discussion (Misc queries) 1 May 15th 08 12:53 PM
Remove space from text in cell Dave Birley Excel Programming 4 July 24th 07 03:06 PM
Location of space in a text in a cell Rasoul Khoshravan Excel Worksheet Functions 1 October 1st 06 10:01 AM
sperate from the space, in text, in the same cell Fam via OfficeKB.com Excel Programming 7 May 31st 06 05:21 PM


All times are GMT +1. The time now is 10:02 AM.

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

About Us

"It's about Microsoft Excel"