#1   Report Post  
Christopher Anderson
 
Posts: n/a
Default VB Code help

Here is a portion of one of my VB Macros in Excel:

If Selection.Count 0 Then
MsgBox ("Average = ") & (RunningTotal / Selection.Count), vbInformation,
"Average"
End If

My question: How do I format the number (RunningTotal/Selection.Count) to
look like 0.000, instead of 0.0000000000000000?? What should my code look
like with the new formatting.

Thanks

Chris


  #2   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Chris,

Try this:
....Format((RunningTotal / Selection.Count), "0.000")...
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Christopher Anderson" wrote
in message ...
Here is a portion of one of my VB Macros in Excel:

If Selection.Count 0 Then
MsgBox ("Average = ") & (RunningTotal / Selection.Count),
vbInformation,
"Average"
End If

My question: How do I format the number (RunningTotal/Selection.Count) to
look like 0.000, instead of 0.0000000000000000?? What should my code look
like with the new formatting.

Thanks

Chris




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
Code not working and can't see why Steve Excel Discussion (Misc queries) 3 December 31st 04 03:12 PM
Often-Used Code not working in a new Workbook Steve Excel Discussion (Misc queries) 2 December 16th 04 11:55 PM
how can i select all the cells with same color on a sheet if there are multipale colors by vba code uobt Charts and Charting in Excel 1 December 15th 04 05:27 PM
Problem with Date format from VBA code twig Excel Discussion (Misc queries) 3 December 7th 04 06:01 PM
Problem Code: Retrieving Stored Access 03 Query Bettergains Excel Discussion (Misc queries) 2 December 7th 04 04:11 PM


All times are GMT +1. The time now is 03:12 PM.

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"