Open and Filter Folder

i_stoeva

New Member
Joined
Jun 7, 2006
Messages
29
Hi all,

could some one help me with this project....I have a command button which I want when being clicked to open a folder situating on this path: \\Server\Chef\Fakturi\Donau\2006

For this part i tired the following code, but it gives me an error:

Code:
Private Sub CommandButton1_Click()
Status = Shell("Explorer.exe /n, /n, " & "\\Server\Chef\Fakturi\Donau\2006 ", vbMaximizedFocus)
End Sub

saying that variable not defined, and when I use it on other pc in works...Where could be the problem?

And second question....when i make this command button works how to tell it, when opens the folder to filter only those files which are equal to the value of cell B3...

Is this possible by the way?

Thanks you,
Iva
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Can't help you with the first bit but the second might work like this

Code:
Sub Filtering()
a = Sheets("Sheet3").Range("B3").Value
    Selection.AutoFilter
    Selection.AutoFilter Field:=2, Criteria1:=a
End Sub


Making the necessary alterations to suit your book

HTH


Dave
 
Upvote 0
The issue with the first part might be a version issue. Do you use the same version of Excel at work on all PC's

I tried your code and it worked fine (other than I didn't have that file) I run Excel 2003 perhaps your work has 97 running on some of it's PC's and 2003 on others


Dave
 
Upvote 0
No, on both PC's is Excel 2003...I make the files on my PC and transfer them to the other, but both are with excel 2003. I checked also the VBA Preferences - and they are the same....This is a big puzzle for me...
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

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