Can't get VBA code to read every sheet individually... Please help, I'm sure I've missed something silly

Chassee

New Member
Joined
Mar 21, 2023
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi There.... I am creating a code to prevent a user from doing "Save As" if not all boxes I designate are filled in based on other parameters on that excel sheet (such as certain cells having values). I have 35 different sheets that are all the same (it's for different devices being tested by our techs, we don't necessarily use every sheet every time) and one sheet that is different. I want excel to perform the code below (plus 22 other if's) on each page if the if and and statement is met.

This code doesn't seem to work though but no issues when compiling the code. Any help would be great. Below is my code:


Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
If ws.Name Like "BF" Then
End If
If Cells(17, 5) = "Reduced Pressure" And Cells(29, 5) = "" Then
MsgBox "CHECK #1 missing value on Worksheets.Name", vbExclamation, "Dignity Fire Protection"
Cancel = True
Application.Goto Cells(29, 5)
End If

If ws.Name Like "BF" Then
End If
If Cells(17, 5) = "Reduced Pressure" And Cells(31, 5) = "" Then
MsgBox "CHECK #2 missing value Worksheets.Name", vbExclamation, "Dignity Fire Protection"
Cancel = True
Application.Goto Cells(31, 5)
End If
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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