Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default Prevent invalid data when pasting from Word directly onto cell?

I have a spreadsheet that a customer uses to provide me with catalog data for
our application. Despite direction, he consistently provides data that
exceeds maximum field lenghts for our database. I have tried conditional
formatting and restricting the data based on max length but he is often
copying the text from Work and just pasting it idirectly nto the Excel cell
(not using the text bar). Neither formatting or restricting work in this
scenario. Any ideas on how to prevent him from being able to paste in
invalid data?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Prevent invalid data when pasting from Word directly onto cell?

Data - Validation

Text length from the drop-down

enter a max number...

You can make an message too!

"Stacey" wrote:

I have a spreadsheet that a customer uses to provide me with catalog data for
our application. Despite direction, he consistently provides data that
exceeds maximum field lenghts for our database. I have tried conditional
formatting and restricting the data based on max length but he is often
copying the text from Work and just pasting it idirectly nto the Excel cell
(not using the text bar). Neither formatting or restricting work in this
scenario. Any ideas on how to prevent him from being able to paste in
invalid data?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default Prevent invalid data when pasting from Word directly onto cell

Sean, that only works if you actually click into the cell, then paste the
data. If you copy text from word and just select the cell and paste it won't
perform the data validation.

"Sean Timmons" wrote:

Data - Validation

Text length from the drop-down

enter a max number...

You can make an message too!

"Stacey" wrote:

I have a spreadsheet that a customer uses to provide me with catalog data for
our application. Despite direction, he consistently provides data that
exceeds maximum field lenghts for our database. I have tried conditional
formatting and restricting the data based on max length but he is often
copying the text from Work and just pasting it idirectly nto the Excel cell
(not using the text bar). Neither formatting or restricting work in this
scenario. Any ideas on how to prevent him from being able to paste in
invalid data?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Prevent invalid data when pasting from Word directly onto cell?

Try this event code.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then
With Application
.EnableEvents = False
If Len(Target) 14 Then
MsgBox "Listen up Knob! Maximum of 14 characters!!"
Target.Value = ""
End If
.CutCopyMode = False
.EnableEvents = True
End With
End If
End Sub

Since you don't provide any range, I have used all of Column D and a max.
number of characters of 14. Edit to suit.

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that module. Edit to suit and Alt + q to return to the
Excel window.


Gord Dibben MS Excel MVP

On Thu, 25 Sep 2008 12:31:02 -0700, Stacey
wrote:

I have a spreadsheet that a customer uses to provide me with catalog data for
our application. Despite direction, he consistently provides data that
exceeds maximum field lenghts for our database. I have tried conditional
formatting and restricting the data based on max length but he is often
copying the text from Work and just pasting it idirectly nto the Excel cell
(not using the text bar). Neither formatting or restricting work in this
scenario. Any ideas on how to prevent him from being able to paste in
invalid data?


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
prevent changes to cell references when copying and pasting MiChaos Excel Discussion (Misc queries) 2 July 3rd 07 04:21 PM
Pasting delimited text from clipboard directly into Excel Spreadsh Anexceluser New Users to Excel 2 February 11th 07 01:57 AM
Is there a way to prevent pasting data into an Excel worksheet? Rod from Corrections Excel Worksheet Functions 16 November 20th 06 01:01 PM
Pasting Excel data into Word doc. mjdntn Excel Worksheet Functions 0 September 26th 06 04:38 PM
Prevent Row Height from increasing when Pasting lenghthy text into Cell. Hal Excel Worksheet Functions 3 August 25th 06 10:23 PM


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