VBA to open a CSV, average data and return the result to textbox in userform

Status
Not open for further replies.

JackDomino1

New Member
Joined
Apr 7, 2020
Messages
39
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm looking to have a button in a userform. Once pressed, allow the user to select a CSV file and open it. The code then needs to take an average of a specified range, for example B2:B14 and report the result in a textbox in the userform. The CSV can then close.

Note, the file directory of the CSV will always be different, so the user has to be able to navigate folders to find the file they require. However, the range "B2:B14" will always be the same, in every file.

Thanks :)
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Further thought, the result of the "average" function need not write to the textbox in the userform. If the result of the average could be copied to a cell in "sheet2" of the original workbook, that would be ideal.
 
Upvote 0
Thread closed at OP's request
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,639
Messages
6,125,967
Members
449,276
Latest member
surendra75

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