LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Cell specific code

I want the code below to run only when cell B4 is selected and show the
Calendar only if the value in cell N2 is 0. If I click on cell B4 and cell
N2 is greater than 0, my message displays just as I want it to. But for some
reason Calendar displays no matter what cell I select. Where have I gone
wrong?


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(Target, Range("B4")) Is Nothing Then

If Range("N2").Value 0 Then GoTo NotBlank
End If

Calendar.Show

GoTo Finished

NotBlank:
MsgBox "This Workbook contains Vacation data. That data must be removed
before you can change the year. If you want to start a new year, please use
the Template."

Finished:

End Sub

 
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
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
code to caputre time in vb in a specific cell JTS Excel Programming 1 August 26th 08 02:07 AM
Use a code to populate a cell with a specific value braveT Excel Worksheet Functions 5 April 13th 07 10:02 PM
UDF code to find specific text in cell comments, then average cell values bruch04 Excel Programming 3 December 5th 05 10:01 PM


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