#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Message Box

Hi - I want to create a message box which opens at the end of the macro which
tells the user how many records (rows) exist on the worksheet. When user
clicks ok, the macro closes.
Please tell me how to code the msgbox that will do this.

Thanks,

Yasser
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Message Box

Put the following code at the end of your procedure.

MsgBox "There are " & Format(ActiveSheet.UsedRange.Rows.Count, "#,##0") & _
" rows on the active sheet.", vbOKOnly, Title:="Title Text"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"yasser" wrote in message
...
Hi - I want to create a message box which opens at the end of the macro
which
tells the user how many records (rows) exist on the worksheet. When user
clicks ok, the macro closes.
Please tell me how to code the msgbox that will do this.

Thanks,

Yasser



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Message Box

Try this:
MsgBox Sheets("Sheet1").UsedRange.Rows.Count & " records"

Subtract 1 from the count if there is a header row.

Hth,
Merjet


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
replace VBA run-time error message with custom message BEEJAY Excel Programming 13 July 14th 06 03:59 PM
Replace Excel Message w/Custom Message Kevin R Excel Programming 1 May 18th 06 04:13 PM
Intercept/replace standard 'cell protected' message with my own message? KR Excel Programming 3 March 16th 06 02:31 PM
Opening an attachment of a message that has a message as attachmen vetron Excel Programming 0 January 30th 06 06:17 PM
Displaying a message in a message box without requiring user to click anything to proceed Android[_2_] Excel Programming 2 June 25th 04 06:44 PM


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