LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default Clearing contents not formatting

I posted not too long ago and Gary's Student gave me the following code to
solve my problem:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set b = Range("D:D")
If Intersect(t, b) Is Nothing Then Exit Sub
If t.NumberFormat = "General" Then Exit Sub
Dim s As String
s = t.Value
If Left(s, 1) < "=" Then Exit Sub
Application.EnableEvents = False
t.Clear
t.Formula = s
Application.EnableEvents = True
End Sub

The above code is designed to change the formatting of a cell from 'text' to
'general' if the user inputs an equal sign.

My only concern now is that the t.Clear line wipes out all the other
formatting too. Any suggestions on how to keep the background color and
indentation but swap out the text for general?
 
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
Conditional Formatting/Contents THINKINGWAY Excel Worksheet Functions 3 December 28th 07 08:25 PM
Selectively Clearing cell contents jdd Excel Worksheet Functions 2 April 22nd 06 04:06 AM
Clearing the Contents of Merged Cells prizm1 New Users to Excel 2 September 10th 05 04:42 AM
Clearing Contents of Cell Burt Excel Worksheet Functions 1 May 4th 05 02:46 PM
Clearing Contents but not Formulas Louise Excel Worksheet Functions 6 January 27th 05 05:04 PM


All times are GMT +1. The time now is 06:38 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"