command button with labels to choose which file

almouchie

Board Regular
Joined
Dec 23, 2004
Messages
128
I have this simple code


Sub OpenFile()

ChDir "M:\George-Rola\DECEMBER"
Workbooks.Open Filename:="M:\George-Rola\DECEMBER\INVOICES-620.xls"
End Sub


but I want to have a text label in my sheet to write down which file to open, or several files & click the command button to open these file , or use these file for data input
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Can you

have a cell in the worksheet be where the filename (and path) is located and then, just reference that cell after Filename:= ?

That's how I've often accomplished that; I assign the value of the cell to a variable (ex. myFileName) and handle it that way.

It should work the same way with a TextBox, Label or whatever else you want to try.

Maybe I misunderstood your Q.
 
Upvote 0
fill formula down till it find a blank cell

i have a macro & a formula to insert in a cell
i want to auto fill it down the rows until it finds a blank in a certain cell say B

it looks like this
Selection.AutoFill Destination:=Range("M3:M13"), Type:=xlFillDefault

i dont want to name the range but rather to fill down as long cell B is not blank

any help is appreciated
 
Upvote 0
Why don't you u se GetOpenFileName?
 
Upvote 0
how would i do that GetOpenFileName
i didnt find anything to get me started on it
whats the code look like
 
Upvote 0

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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