View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Detect lines in specific sheet at load time

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

On Error GoTo ws_exit:
Application.EnableEvents = False
Set rng = ActiveSheet.UsedRange
If rng(rng.Count).Row 10 Then
MsgBox "last row is " & rng(rng.Count).Row
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ladyhawke" wrote in message
ups.com...
I would like to provide a message box to inform the user if a specific
sheet contains rows with content after row 10.

How can this be done and can I make a sub for it so it returns true if
rows are there rows in that sheet. That would be useful when performing
the action that might insert info there (to warn the users of new
information available)

regards,
Ladyhawke