Thank you Dave,

The code you suggested worked fine. Although i discovered that the user can
still open the file with macro disabled and change the cell content, save
and reopen it.  now I wish when the workbook is open, it checks the value of
sheet1(D3) if equal to "BRIDGESTONE COMPANY INC." if yes then continue,
other wise close the workbook.

On Tue, Apr 27, 2010 at 10:30 AM, Dave Bonallack
<davebonall...@hotmail.com>wrote:

>  Hi,
> Try this code instead:
>
>
> Private Sub Worksheet_Change(ByVal Target As Excel.Range)
>     On Error Resume Next
>     If Sheets("Sheet1").Range("D3") <> "BRIDGESTONE COMPANY INC." Then
>
>         MsgBox " FILE WILL BE CLOSED!!", vbOKOnly + vbExclamation
>         MsgBox "Please contact EDP "
>         ThisWorkbook.Close savechanges:=False
>     End If
> End Sub
>
> Change the sheet name to suit.
> Regards - Dave.
>
> ------------------------------
> Date: Mon, 26 Apr 2010 16:30:04 +0800
> Subject: $$Excel-Macros$$ worksheet change event problem
> From: osav...@gmail.com
> To: excel-macros@googlegroups.com
>
>
> Dear group,
>
> i try to catch the user's action via worksheet change event.  My worksheet
> has a value at cell D6 that i would like to remain constant and if that
> value is change by user the workbook is closed.
>
> My problem now is, even if this values are unchanged but if any other range
> of cell is deleted, the macro is triggered which i really don't understand
> why?  The macro is triggered when i delete a content of a cell range.   but
> if a single cell is deleted nothing happens.
>
> any suggestion why is this so?  here is my code.
>
> Private Sub Worksheet_Change(ByVal Target As Excel.Range)
> On Error Resume Next
> If Target = [$D$3] Then
>         If Target.Value <> "BRIDGESTONE COMPANY INC." Then
>             MsgBox  " FILE WILL BE CLOSED!!", vbOKOnly + vbExclamation
>             MsgBox "Please contact EDP "
>             ThisWorkbook.Close savechanges:=False
>         End If
>     End If
>
> End Sub
>
> --
>
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links :
> http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
> To post to this group, send email to excel-macros@googlegroups.com
>
> <><><><><><><><><><><><><><><><><><><><><><>
> HELP US GROW !!
>
> We reach over 6,800 subscribers worldwide and receive many nice notes about
> the learning and support from the group.Let friends and co-workers know they
> can subscribe to group at
> http://groups.google.com/group/excel-macros/subscribe
>
> ------------------------------
> Australia's #1 job site If It Exists, You'll Find it on 
> SEEK<http://clk.atdmt.com/NMN/go/157639755/direct/01/>
>
> --
>
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links :
> http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
> To post to this group, send email to excel-macros@googlegroups.com
>
> <><><><><><><><><><><><><><><><><><><><><><>
> HELP US GROW !!
>
> We reach over 6,800 subscribers worldwide and receive many nice notes about
> the learning and support from the group.Let friends and co-workers know they
> can subscribe to group at
> http://groups.google.com/group/excel-macros/subscribe
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to