space then date causes error

S

ss

On my spreadsheet they have to type in a date and other calculations are
taken from this point. Of the hundreds that have used it there have been
no problems, however as always there will always be one.......

When they fill in the date they type a space and then type the date,
this throws up errors in the other calculations.

Not altogether important but is there an easy fix for this, so that if
anyone types a space it is ignored, I dont want to get involved in
VBA/macro stuff.
 
D

Don Guillett

Right click the sheet tab>view code>insert this>modify range to suit

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("a1:z10")) Is Nothing Then
Target = Application.Trim(Target)
End If
End Sub
 
S

ss

Right click the sheet tab>view code>insert this>modify range to suit

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("a1:z10")) Is Nothing Then
Target = Application.Trim(Target)
End If
End Sub

Don, thanks for the reply & solution. One question though, will this
throw up `contains macro` warning if emailed to others as this is likely
to cause other issues.
 
D

Don Guillett

Don, thanks for the reply & solution. One question though, will this
throw up `contains macro` warning if emailed to others as this is likely
to cause other issues.

Of course. So save as an .xlsx file which automatically strips all
macros or delete the macros and save as a different name before
sending.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top