Mesagebox VBA that tell you what header is not filled in

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

I'd like a macro that when its run will do the following:

On Activesheet,
Get the Number from Cell B5, Look at each Number in range C5:AB5
if any of these numbers are not the same as in B5 make a list and message box what headers are not correctly filled in (Headers are in row 7)

So if I was writing this in English this is how I'd put it,
Run Macro,

Look at Value in activesheet B5 and remember it,

Then look along range C5:AB5 if any of the numbers in any of these cells are not the same as B5 then look at the header title in row 7 and remember it,

then once you have done all the cells message box "The following Columns have data missing, please correct this before proceeding"
then list each header as a separate Row

I'm struggling this this please help if you can

Thanks

Tony
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi
What about
VBA Code:
Sub test()
Dim x As String
Dim cel As Range
x = ""
For Each cel In Range("C5:AB5")
If cel <> Range("B5") Then
x = x & vbLf & cel.Offset(2)
End If
Next
MsgBox "The following Columns have data missing, please correct this before proceeding" & vbLf & x
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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