LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Data validation when pasting data

Hi,

Using the worksheet change event you can capture the whether the user
has something copied by testing for:

If Application.CutCopyMode = xlCopy Then

This will only = xlcopy when pasting, you are then able to change the
result to fit your formatting as you know what cell the user is in etc.
so you could test the length and append a zero or alternatively
pastevalues which will then take on your validation.

James


pablo bellissimo wrote:
Hi All,

I'm a total newbie with VBA so please be patient!
I need to assign data validation to a single column in a worksheet to ensure
that users can only enter 11 digits but the first one must be a zero. I can
force the text length to be 11 which is fine but when users paste a list
(from another sheet) it overwrites the validation, and drops the leading zero
(due to it being a number).
I can't just change the format to display the leading zero as I need to feed
the full 11 digits into another system.

In summary, does anyone have a bit of code that will prevent users from
pasting anything into the column that does not match the validation criteria?
I dont want to just turn off the paste functionality.

Any help would be greatly appeciated.

Pablo


 
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
custom data validation on cells with data validation values AKrobbins Excel Worksheet Functions 2 June 21st 11 04:20 PM
Data validation vs. cutting pasting Illya Teideman Excel Discussion (Misc queries) 0 August 22nd 07 12:32 PM
Why does data validation not work when pasting data into a cell. rjshelby Excel Discussion (Misc queries) 1 July 31st 06 09:08 PM
Refresh existing data when changed in data validation list problem girl New Users to Excel 1 September 28th 05 10:19 PM
Pasting on Filtered Data Sheets without pasting onto hidden cells CCSMCA Excel Discussion (Misc queries) 1 August 28th 05 01:22 PM


All times are GMT +1. The time now is 06:37 AM.

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"