Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Turn off pasting in range of cells

Is it possible to keep people from pasting anything in a group of cells. I have a group of cells(a1:a5) that I don't want people to be able to paste anything in. Any help would be great. Thanks. Matt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Turn off pasting in range of cells

Matt

lock them (which they should be by default) and protect the sheet.

Regards

Trevor


"Matt" wrote in message
...
Is it possible to keep people from pasting anything in a group of cells.

I have a group of cells(a1:a5) that I don't want people to be able to paste
anything in. Any help would be great. Thanks. Matt


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Turn off pasting in range of cells

Right click on the sheet tab where these cells are located

select view code

At the top of the module, In the left dropdown select worksheet and in the
right dropdown select selectionChange

Put in code like below in that event.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Not intersect(target, Range("A1:A5")) is nothing then
Application.cutcopymode = false
msgbox "Please do not try to paste in A1:A5"
End if
End Sub

--
Regards,
Tom Ogilvy


"Matt" wrote in message
...
Is it possible to keep people from pasting anything in a group of cells.

I have a group of cells(a1:a5) that I don't want people to be able to paste
anything in. Any help would be great. Thanks. Matt


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Turn off pasting in range of cells

Another way would be to lock the cells and protect the worksheet
(tools=Protect=Worksheet). I assumed you didn't want to do that, but
perhaps you are not aware of sheet and cell protection.

The default property for cells is to be locked. You would need to unlock
the cells you want to allow changes to (format=Cells, protection tab,
uncheck locked)
--
Regards,
Tom Ogilvy
"Matt" wrote in message
...
Is it possible to keep people from pasting anything in a group of cells.

I have a group of cells(a1:a5) that I don't want people to be able to paste
anything in. Any help would be great. Thanks. Matt


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Turn off pasting in range of cells

Thanks Tom. I didn't want to lock the cells. I have a validation list in each of these cells. For some reason though, Excel will allow you to paste something in these cells even though it is not in the validation lists. Then when you delete the text in the cell it removes the data validation drop down list. Any ideas how to fix this? If not, thanks for the other info, it works. Thanks again. Matt


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Turn off pasting in range of cells

Actually, it is the pasting in the cells that removes the dropdown list.
Validation is treated as formatting, so with a straight paste, the source
formatting is applied (which does not contain the validation).

Locking the cell and protecting the sheet will prevent this and the List
style validation still works.

--
Regards,
Tom Ogilvy


"Matt" wrote in message
...
Thanks Tom. I didn't want to lock the cells. I have a validation list in

each of these cells. For some reason though, Excel will allow you to paste
something in these cells even though it is not in the validation lists.
Then when you delete the text in the cell it removes the data validation
drop down list. Any ideas how to fix this? If not, thanks for the other
info, it works. Thanks again. Matt


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Turn off pasting in range of cells

I have some validations in the cell, for maxlengths etc. But, when
paste the text directly into the cell (without going into the cel
first), the validation is removed. Even when I do paste special a
text, then the validation is not removed, but doesnt work. So, I nee
to disallow pasting into cells directly without going into the cel
first, so that validation remains

--
Message posted from http://www.ExcelForum.com

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
How can I turn off the clipboard icon when cut and pasting? Caroilin Setting up and Configuration of Excel 1 September 21st 06 05:40 PM
Pasting a formula in multiple cells without changing the range Jeff Wheeler Excel Discussion (Misc queries) 3 June 15th 06 04:52 PM
pasting non-contiguous range of cells to new row, same cell locati Not excelling at macros New Users to Excel 3 April 4th 06 08:57 PM
fractions turn into dates when pasting in excel 2003 Eddie Spaghetti Excel Discussion (Misc queries) 5 March 24th 05 03:07 PM
Pasting the same Value into a Range of Cells mmc308[_2_] Excel Programming 4 January 4th 04 08:55 PM


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