Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook close event


Hi,

I need to add validation which sees if any of the cells in a column are
empty. If yes, then I need to show a message to the user.

I need to write this dynamically in VB.net depending on the number of
rows.
How do I do this?

KPC


--
kpriyac
------------------------------------------------------------------------
kpriyac's Profile: http://www.excelforum.com/member.php...o&userid=37535
View this thread: http://www.excelforum.com/showthread...hreadid=573077

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Workbook close event

Perhaps something like this: HTH Otto
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Sheets("TheShtName")
Set Rng = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
End With
If Rng.Count Application.CountA(Rng) Then
MsgBox "Some empty cells."
Cancel = True
End If
End Sub

"kpriyac" wrote in
message ...

Hi,

I need to add validation which sees if any of the cells in a column are
empty. If yes, then I need to show a message to the user.

I need to write this dynamically in VB.net depending on the number of
rows.
How do I do this?

KPC


--
kpriyac
------------------------------------------------------------------------
kpriyac's Profile:
http://www.excelforum.com/member.php...o&userid=37535
View this thread: http://www.excelforum.com/showthread...hreadid=573077



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook close event


what does the end do in the following statement -

Set Rng = .Range("A1", .Range("A" & Rows.Count).End(xlUp)

--
kpriya
-----------------------------------------------------------------------
kpriyac's Profile: http://www.excelforum.com/member.php...fo&userid=3753
View this thread: http://www.excelforum.com/showthread.php?threadid=57307

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Workbook close event

It's like hitting the END key on the keyboard.

The code says to go to .range("a" & rows.count)
which is the same as
..range("a65536") (the bottom cell in column A)

So if you were doing it manually, you'd go to A65536, hit the End key and
finally the up arrow key (xlup in code).

It finds the last use cell in that column (A).


kpriyac wrote:

what does the end do in the following statement -

Set Rng = .Range("A1", .Range("A" & Rows.Count).End(xlUp))

--
kpriyac
------------------------------------------------------------------------
kpriyac's Profile: http://www.excelforum.com/member.php...o&userid=37535
View this thread: http://www.excelforum.com/showthread...hreadid=573077


--

Dave Peterson
Reply
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
Workbook-Close StopTimer event Stonewall Rubberbow Excel Discussion (Misc queries) 2 January 12th 08 11:06 PM
Excel WorkBook Close Event Xcelion Excel Programming 2 January 27th 06 03:29 PM
Workbook Before Close Event Cancel flag not functional(?) Kristian Mayville Excel Programming 0 July 21st 05 02:46 PM
Workbook Close Event Stefano Condotta Excel Programming 1 June 16th 04 10:44 PM
Clear Clipboard on Workbook Close Event (Excel XP) Culichi Excel Programming 2 February 23rd 04 06:21 PM


All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"