Turning button visible when sheet is complete

hulse509

New Member
Joined
Nov 26, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have a sheet that is used as a bill of lading for shipping. It includes a button to run macros that will save, print, and clear certain cells when the required fields have been filled in. What I am trying to do is make it so that the mentioned button cannot be seen if all the required fields are not filled in. I have tried to use the code from multiple other thread on the forums and thus far I have not been able to make anything work. The closest I have been able to get is the below code, It will make the button invisible if the first cell is empty but I cant figure out how to require all cells to be filled in.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If Range("B7").Value <> "" Then
Me.Shapes("CommandButton1").Visible = True
Else
Me.Shapes("CommandButton1").Visible = False
End If
End Sub

I would need cell E7, G8, and B9 to be filled in as well. One thing I have found out is that it is not an ActiveX button so the Me.Shapes is what is needed.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi,
welcome to forum

try

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Me.Shapes("CommandButton1").Visible = Application.CountA(Me.Range("B7,B9,E7,G8")) = 4
End Sub

Dave
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,840
Members
449,193
Latest member
MikeVol

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