activecell

seacrest

Active Member
Joined
Aug 15, 2002
Messages
301
Does anyone know how i can determine the activecell contents of a hidden sheet then i want to apply a if statement to it.
My idea is this if someone manages to unprotect this sheet and tampers with it i will have a number in that cell,then if cell <>123456 then the workbook will destroy itself.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
In the hidden sheet:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Cells(1, 1) <> 123456 Then
ThisWorkbook.Close SaveChanges:=False
End If
End Sub
 
Upvote 0
I think you can assign a cell, say C1 in other sheet, = A1 of the hidden sheet. And use the code bellow to check the change of C1:

Private Sub Worksheet_Calculate()
If Cells(1, 3) <> 123456 Then
ThisWorkbook.Close SaveChanges:=False
End If
End Sub
 
Upvote 0
Emily i appreciate your help but i dont think i have made myself very clear.
I want to be able to tell if the sheet has been changed because when i save it i will leave my mouse on say cell a1 which has the contents 123456 if the sheet has been accessed it is unlikely it would still be on a1.So with saying that i want a if statement on auto_open to determine if the sheet has been opened. (I have some code which deletes the active sheet without sending it to the recycle bin.
 
Upvote 0
I think you would be better off capturing a event like the sheet change or activate to trigger your code. As Emily was suggesting.

If your VBA is passworded, your sheet protected and set to xlsheetveryhidden the only way to unhde is through VBA. If they go to all the work to crack that they would probably clean out your self destruct code.

Anyway back to your original question. First you need to have a sheet active to see which is the activecell. Try this it will work on hidden sheet.<pre>
Sub hidsh()
Worksheets("Sheet3").Activate
If ActiveCell.Address = "$A$1" Then
MsgBox "File is Good"
Else:
MsgBox "boom"
End If
End Sub</pre>
This message was edited by Dragracer on 2002-09-29 01:17
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top