select columns of RefEdit box

Ms.Sigma

New Member
Joined
Mar 1, 2011
Messages
35
hello all,

I have raw data in sheet1.

In user form, there are:

- one RefEdit box ( for selecting data of sheet1)
- several option buttons (such as option1,option2,option3)
- one textbox (for displaying a value derived from one function)

In order to calculate the expected value which will be displayed in textbox, one important parameter is the variance of each column. In RefEdit box, I may select different columns of sheet1. Now, the problem is concerning columns selection of RefEdit box.

I use "worksheetfunction.VarP" to calculate the variance of a column, and V denotes variance. I defined:

V=application.worksheetfunction.VarP(RefEdit1.Columns(1)) 'This is for calculating variance of the first column of selected data of RefEdit box.

V=application.worksheetfunction.VarP(RefEdit1.Columns(2)) 'This is for calculating variance of the second column of selected data of RefEdit box.

but it seems this is not the correct way since I cannot get the expected value.

Could someone give me some direction? Thanks a lot!!:)
 
Last edited:

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hello again,

I redefined macros, and now it seems OK.

Dim Selrange As Range
Dim Addr

Addr = RefEdit1.Value
Set Selrange = Range(Addr)

V = Application.WorksheetFunction.VarP(Selrange.Columns(1))
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,865
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top