Excel Copy and Paste while maintaining data validation - excel

When I perform a copy and paste from a blank cell to a cell with data and validation, the validation in the destination cell itself gets deleted.
Is there anyway I could maintain the validation in the destination cell while only pasting the values? (And validating the contents that are pasted)
(Also, and hence the reason why I ask this, I'm not allowed to use the "Paste Special" feature, so a workaround is required)

You have to use VBA (create a macro) to be able to do this.
An example of some code is at this SuperUser link.

Related

Can you allow input but disable paste in Excel?

I have an Excel sheet protection set up with intricate conditional formats. I want to allow user input (typing) in a range of cells, but I want to disable copy/pasting in the same range.
2 reasons:
If a user copies from elsewhere and paste into this range, it destroys my conditional formatting. However, an unsophisticated user will never remember to use "paste value only".
If a user is in filtered view and copy and paste in a non-continuous range, the paste will overwrite values in hidden rows without the user even knowing, all they see is that some copied values "disappeared", thus changing values in hidden cells unintentionally.
Is this doable without VBA? because I need this to work with Excel Online with users using the file through SharePoint.

Vba excel: invisibility if data in cells

I am dumping data from one sheet to another using vba code .All cells are getting correctly populated except 6 cells in the beginning.Actually the data us populated in these cells but its not visible until I double click on the cells.What is going wrong.Can someone help?
If you are blaming the wrong format you have two options:
a) clear the format of the destination cells, e.g. Worksheets("DestinationSheet").Range("A1:A6").ClearFormats and then copy the data without formatting
b) copy the format from some cell whose format is correct, e.g. Worksheets("DestinationSheet").Range("B1").Copy Destination:=Worksheets("Sheet1").Range("A1:A6") and then copy the data without formatting (this means you copy good format but wrong data first, but then in the next action you are going to overwrite the wrong data with good data)
Note 1: to copy the data without formatting it is better to use direct assignment Worksheets("DestinationSheet").Range("A1:A61").Value = Worksheets("SourceSheet").Range("A1:A6").Value than Copy function
Note 2: In my view it is always better to avoid using Copy & Paste in two commands because you are messing with the system clipboard, which it dangerous at least. Just imagine the user wants to use the clipboard in another program at the same time you are running the macro in Excel... To my best knowledge, the Copy function above (without being followed by Paste) does not use the system clipboard (please someone do correct me if I am wrong)

Excel Data Validation - Dont allow Formulas

Is there any way of using Data Validation to stop someone entering a Formula and only allow text?
I don't want somebody using a formula to search very hidden sheets because they will know the names of these sheets.
I know excel is not secure, but I don't want someone to easily read these sheets with just =SHEET!A1
I have tried custom validation
=ISERROR(FIND("=",A1))
but unfortunately I need to allow them to use the = sign
Yes - really simple - create a Custom data validation and use formula: =NOT(ISFORMULA(A1))
No need to over-engineer it with VBA, but of course its easily disabled
No there is not. The closest you could come would be to write a UDF that detects the presence of a formula; enter that UDF on some cell in the active sheet, and reference that cell in the data validation formula.
However, that would not prevent a user from entering a formula in some other cell, and then copy/paste to the validated cell. Data validation only checks when a formula is entered directly. It does not check that pasted data conforms to the rule(s).
Jeeped's suggestion of using worksheet event code would be the way to go. And you could easily protect the entire sheet from that phenomenon.

Excel: Can we prevent Paste Operation on cells

I have made one worksheet. And there I don't have option for Macro Enabled, as It is going to be distributed among lots of users to fill the information.
Now the question is, there are some data validation fields in worksheet.
If I do copy any data and paste on that field column, it takes any values in that, which is not correct.
Is there any way to prevent paste on cells without Macro code?
Thank you,
If you want to prevent ANY data entry in those cells you can mark them as locked & protect the sheet with a password.
If you want to allow editing those cells but need to validate that only certain data is allowed, you can use Data Validation, Custom & enter a formula.
You won't be able to use custom VBA functions but most standard Excel functions should work.

Data Validation in Excel through Cell

I want to set up Data Validation on a cell / row of cells so that the value in that particular cell cannot be changed but all the rest of the sheet can be edited, thus why I am not using read only.
Currently if I enter the value in the cell, go to Data > Data Validation > Custom & enter ""it achieves this (see screenshots http://imgur.com/a/Ggqar)
What I want to do is set this validation via the cell rather than manually as I plan on writing this field entry when create the excel document through my application.
I have done a lot on searching online and found methods for doing countif etc.. but nothing deal with formula entry for the Custom criteria.
Is anyone able to help?
Thanks for the quick reply DanB but it's not exactly what I am trying to achieve. My end goal is that my application can pass a value into the file (Column A Row 1 [If easier for formatting it can go into each row in column A which is populated but not required]) and the file will be saved locally. The user will then be entering details in Column B, C, D, E, etc... on their local machine, saving it and processing the file again. I want the application to check Row 1 Col A for the value and decide on how to process the remainder of the file based on this value (the reading the values in the file works already). Because each time my application generates a file it will be unique I want to try do the Data Validation using a formula in the cell so that I can write it using my application and not have to manually apply settings to the file. Is it possible to do this kind of validation using only formulas in the cell when populating it?
Fastest solution would be to use a Protected sheet, but only protect that Cell.
To do this, select the entire sheet, and choose Format Cells.
On the Protection tab, remove the check from Locked.
Now, select just the cell you want to protect, and lock it using the same method. At this point, your entire sheet, except for the 1 cell should have Locked unchecked.
Now, on the review tab within Excel, choose protect Sheet, and uncheck the option to "Select Locked Cells".
Then, while the sheet is protected(you can password protect that part of it), that cell can't even be selected, yet the entire rest of the sheet can be.

Resources