A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

cell format problem



 
 
Thread Tools Display Modes
  #1  
Old September 8th, 2004, 07:24 AM
necip
external usenet poster
 
Posts: n/a
Default cell format problem

Hi there,
Is it possible to format cell for to make one character empty space
between each character.
for example: if I write in to any cell H5F2 then must shown like
H 5 F 2

thanks in advance
necip


---
Message posted from http://www.ExcelForum.com/

  #2  
Old September 8th, 2004, 07:38 AM
Frank Kabel
external usenet poster
 
Posts: n/a
Default

Hi
not possible with a format. This would require VBA

--
Regards
Frank Kabel
Frankfurt, Germany


Hi there,
Is it possible to format cell for to make one character empty space
between each character.
for example: if I write in to any cell H5F2 then must shown like
H 5 F 2

thanks in advance
necip


---
Message posted from http://www.ExcelForum.com/

  #3  
Old September 8th, 2004, 11:35 AM
Jim May
external usenet poster
 
Posts: n/a
Default

If your data is only 4 digits you can use formula:
=LEFT(A1,1) & " " &MID(A1,2,1) & " " &MID(A1,3,1) & " " & MID(A1,4,1)
just a thought,,

"necip " wrote in message
...
Hi there,
Is it possible to format cell for to make one character empty space
between each character.
for example: if I write in to any cell H5F2 then must shown like
H 5 F 2

thanks in advance
necip


---
Message posted from http://www.ExcelForum.com/



  #4  
Old September 8th, 2004, 05:43 PM
Ron Rosenfeld
external usenet poster
 
Posts: n/a
Default

On Wed, 8 Sep 2004 01:24:30 -0500, necip
wrote:

Hi there,
Is it possible to format cell for to make one character empty space
between each character.
for example: if I write in to any cell H5F2 then must shown like
H 5 F 2

thanks in advance
necip



I don't know of any way to do this with formatting.

One approach would be to write an event-triggered VBA routine that adds the
spaces. This would, of course, turn the result into something different than
what you entered. In other words, H5F2 is not the same as H 5 F 2.

If you want to use that approach, the below code can do it. Set aoi to
whatever range(s) you want displayed this way.

To enter the code, right-click on the worksheet tab and select View Code.
Paste the code below into the window that opens.

==================================
Private Sub Worksheet_Change(ByVal Target As Range)
Dim aoi As Range
Dim c As Range
Dim i As Integer
Dim temp As String
Dim temp2()

Set aoi = [A:A] 'change this to reflect area to be formatted this way

Application.EnableEvents = False

If Not Intersect(Target, aoi) Is Nothing Then
For Each c In Target
If Not Intersect(c, aoi) Is Nothing Then
temp = Replace(c.Text, " ", "")
ReDim temp2(Len(temp))
For i = 0 To Len(temp) - 1
temp2(i) = Mid(temp, i + 1, 1)
Next i

c.Value = Join(temp2)
End If
Next c
End If

Application.EnableEvents = True
End Sub

========================================

--ron
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with difference between blank and empty cell balraj Worksheet Functions 1 May 15th, 2004 10:53 AM
format cell reverts to previous format rfs Worksheet Functions 1 January 14th, 2004 05:33 PM
method to copy cell format through formula/VBA? Paul Moles Worksheet Functions 0 January 8th, 2004 12:12 PM
set cell format in user function Vasant Nanavati Worksheet Functions 0 November 24th, 2003 03:33 PM


All times are GMT +1. The time now is 08:40 PM.


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