Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Using Excel WorksheetFunction.Mode function in Access VBA

Or possibly:

Sub Test_worksheetfunction_mode()

Dim result As Double
Dim objSht As Worksheet
Set objSht = Worksheets("Sheet1")

result = WorksheetFunction.Mode(Range("A1:J1"))
MsgBox result

End Sub

to make it a bit shorter.

--

Vasant

"Wei-Dong Xu [MSFT]" wrote in message
...
Hi Alesha,

Thank you for replying!

Furthermore, we can also work with the multiple arguments if you pass

range objects instead of values. For example, each cell "A1, B1, ... J1"
cantains the number:1, 2, 1, 2, 3, 1, 2, 3, 4, 8(each cell contains one

number). I write one sample codes for you:
'Code begin---------------------------
Sub Test_worksheetfunction_mode()

Dim result As Double
Dim objSht As Worksheet
Set objSht = Worksheets("Sheet1")

result = WorksheetFunction.Mode(objSht.Range("A1").Value, _
objSht.Range("B1").Value, _
objSht.Range("C1").Value, _
objSht.Range("D1").Value, _
objSht.Range("E1").Value, _
objSht.Range("F1").Value, _
objSht.Range("G1").Value, _
objSht.Range("H1").Value, _
objSht.Range("I1").Value, _
objSht.Range("J1").Value)
MsgBox result

End Sub
'Code end---------------------------

We will obtain the return value successfully without any mistake.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no

rights.




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
Mode function in excel using Text johnskate17 Excel Discussion (Misc queries) 6 April 18th 13 07:11 PM
Mode Function or MODE Function -- Can't get it to work!! JoAn Excel Discussion (Misc queries) 5 November 4th 09 12:08 AM
how to get write access from read-onlly mode Maus Excel Discussion (Misc queries) 1 August 14th 09 05:04 PM
3D References Mode() Function Excel the-big-john[_2_] Excel Worksheet Functions 1 March 14th 07 09:30 PM
how do I end function mode in excel Goose Excel Discussion (Misc queries) 1 February 17th 06 02:46 PM


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