PC Review


Reply
Thread Tools Rate Thread

Delete space and restrict text length

 
 
New Member
Join Date: Apr 2010
Posts: 1
 
      26th Apr 2010
Hi

I want to delete spaces and need to restrict the text length (e.g +441612890000) in a worksheet.

I tried to use Data Validation, but I have noticed that if you copy and paste the data from a different worksheet then the validation doesn't works.

I tried adding code

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.CutCopyMode = False
End Sub

and

Private Sub Worksheet_Change(ByVal Target As Range)
If target.value meets your_conditions Then
Exit Sub
Else
Target.Value = ""
MsgBox "You can't paste that here."
End If

End Sub



but nothing works.

Is there a way we can develop a button which will delete all the spaces once the data is copied from a different worksheet or can we write a script in the VBE to resolve this?

I would be pleased if someone could help me to sort this out.

Many Thanks

Dee
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
v2007: Text control (plain text): How to restrict length of data? bixcel Microsoft Word Document Management 1 15th Jan 2009 12:51 PM
Delete row if column A cell text length is not 11 John Keith Microsoft Excel Programming 4 1st Oct 2008 02:12 AM
Wanted: Miditower case, with space for: 6 harddisks, 3 cdrom bays, 1 diskdrive bay, power box at the top, good length space for monster graphics cards. Skybuck DIY PC 6 1st Jun 2007 12:36 PM
Why does space bar delete text instead of moving it? =?Utf-8?B?dHdlZXR5MjM=?= Microsoft Word Document Management 3 2nd Jun 2006 01:45 PM
Delete space in Text herve Microsoft Excel Programming 4 4th Oct 2005 07:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:17 PM.