• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Not to allow copy hidden rows columns

smisar

New Member
I have sheet in which I have hidden my price calculation.

I do not want any one else to know this calculation.

Though, I have hidden and protected sheet, when I select the while sheet & copy into new sheet, it copies everything...


How do I protect my calculation? please help...
 
Just a thought:


Keep your pricing calculations in a seperate sheet. Go to VBA screen (Alt+F11). In the properties of the worksheet where pricing calculations are available, change the visible property to "2 - xlSheetVeryHidden" from "-1 - xlSheetVisible". You can even password protect the VBA project of the workbook. That way others will not have access to your pricing calculations.

You can change it to visible whenever you need to work on the file and make it VeryHidden when you are sharing the file.


Hope this helps.
 
@smisar


Hi


I am not sure what do you want exact but try the below code's


paste the first code in the workbook module

[pre]
Code:
Private Sub Workbook_Open()
Application.OnKey "^c", "Copy"
End Sub

and in the normal module paste the below code


Sub Copy()
Dim rng As Range

On Error GoTo Whoa

If Not Selection Is Nothing Then
Set rng = Selection.Cells.SpecialCells(xlCellTypeVisible)
rng.Copy
End If

LetsContinue:
Exit Sub
Whoa:
MsgBox Err.Description, vbCritical, "Error Number : " & Err.Number
Resume LetsContinue
End Sub
[/pre]
with the above codes when user try to copy then only visible cells are copied and paste in another sheet or workbook


hope it is solve your problem other wise please inform


Thanks


SP
 
Hi, smisar!


Sorry to be the bad news man but once someone has got open access to an Excel workbook, there's no safe way to protect... anything. Neither hidden or very hidden cells or worksheets, nor protected workbook or worksheets, nor VBA project code protection. Even if that someone hasn't straight access to the file because or password protection, there're still a lot of few cheap methods por bypassing it.


Further reading:

http://chandoo.org/forums/topic/macro-to-hideunhide-in-protected-sheet-produces-error-code#post-37901


So I'd say that if you don't want no one else to know certain calculation, well, don't put it into an Excel file... anyhow.


Regards!


PS: Macros (automatic and manual) could be disabled by pressing and holding shift key when opening the file.
 
Back
Top