#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Automate Selection

Selva,

Thank you so much. The VBA code works. Just have a question (I am new to VBA
codes). How to view the results in a worksheet (example sheet1) instead of
the message box (MsgBox). I cannot view all the assigned weights.

Many thanks.
--

"Socko" wrote:

Take a look at the following vba procedure, paste it in your code
window and run it.


Sub AssignWeight()
Dim i, j, k As Double
Dim First, Second, Third As Double
Dim DiscreteLevel As Double
Dim sAssignedWeights As String
DiscreteLevel = 0.05

For i = 0 To 1 Step DiscreteLevel
For j = 0 To 1 Step DiscreteLevel
For k = 0 To 1 Step DiscreteLevel
If i + j + k = 1 Then
First = i
Second = j
Third = k
sAssignedWeights = sAssignedWeights & vbNewLine & _
First & ", " & Second & ", " & Third
End If
Next k
Next j
Next i
MsgBox sAssignedWeights
End Sub

I hope this helps

- Selva V Pasupathy
For more on VBA, Excel, & Other Programming
Please visit http://socko.wordpress.com

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
Automate pivot table selection Steve Excel Discussion (Misc queries) 0 July 17th 08 11:34 AM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
Automate selection of specific reference cells njg Excel Discussion (Misc queries) 0 February 26th 06 04:48 AM
Automate column selection Snoopy Setting up and Configuration of Excel 1 January 27th 06 03:26 PM


All times are GMT +1. The time now is 06:57 AM.

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"