Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Excel active x button

$
0
0

Hello,

i have the following script on Excel and works fine:

Option Explicit


Private Sub Worksheet_Change(ByVal Target As Range)
   If Not Application.Intersect(Target, Range("e2")) Is Nothing Then
      If Range("e2").Value >= 1 Then
         CommandButton1.Visible = False
      Else
         CommandButton1.Visible = True
      End If
   End If
End Sub

Private Sub CommandButton1_Click()
With Application.FileDialog(msoFileDialogFolderPicker)
  .InitialFileName = IIf(Range("E2").Value = "", ActiveWorkbook.Path, Range("e2").Value)
  .Title = "Please choose a folder"
  .AllowMultiSelect = False
  If .Show = -1 Then Range("e2").Value = .SelectedItems(1)
End With
End Sub


Sub ddd()
Application.EnableEvents = True
End Sub

this will copy a folder path and paste is in a cell and the button in that cell will disappear. but now the problem this will only work with one button but i would like to have many. how can i fix this?.


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>