Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SG SG is offline
external usenet poster
 
Posts: 9
Default Auto-Trim through validation or the macro

Dear Friends

I have a date with consisting of more than 1200 row and 15 columns;
When I use Pivot Table for this data; I use Trim () function by
linking in a additional worksheet and later on Special paste value
over original data to remove unnecessary spaces

My question is that is there any possibility to use auto Trim Function
through Validation or any other means. OR it is possible to create a
short through macro to use this trim function.

Looking for your help.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Auto-Trim through validation or the macro

Data Validation:

Choose your cells (in this example, the active cell will be A1), the choose Data / Validation....
on the Settings tab, under Allow: choose Custom, then use the formula =A1=TRIM(A1)

You can set a message to say that they entry must not include extra spaces.

You can also use the change event: Copy this code, right-click the sheet tab, select "View Code" and
paste the code into the window that appears.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
On Error Resume Next
Application.EnableEvents = False
If Not Target.HasFormula Then _
Target.Value = Application.WorksheetFunction.Trim(Target.Value)
Application.EnableEvents = True
End Sub


--
HTH,
Bernie
MS Excel MVP


"SG" wrote in message
ups.com...
Dear Friends

I have a date with consisting of more than 1200 row and 15 columns;
When I use Pivot Table for this data; I use Trim () function by
linking in a additional worksheet and later on Special paste value
over original data to remove unnecessary spaces

My question is that is there any possibility to use auto Trim Function
through Validation or any other means. OR it is possible to create a
short through macro to use this trim function.

Looking for your help.



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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Auto Update validation list? Eloise Excel Worksheet Functions 5 October 10th 06 06:35 PM
Can Validation against a list do auto-fill in a cell? pastrami_dave Excel Discussion (Misc queries) 5 October 6th 06 10:56 PM
Auto complete in a validation list Soni Excel Discussion (Misc queries) 1 April 17th 06 05:17 AM
Auto Update A Validation List Dmorri254 Excel Worksheet Functions 2 March 3rd 05 07:29 PM


All times are GMT +1. The time now is 10:24 PM.

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"