Re: How to verify headers

Tech-Archive recommends: Speed Up your PC by fixing your registry



On Oct 18, 8:29 am, "Bernie Deitrick" <deitbe @ consumer dot org>
wrote:
NJ,

Create a new workbook, enter the desired values into the first *** (into the expected cells), and
name that range "Headers".

In the same workbook, insert a codemodule and copy this macro into it:

Sub Compare()
Dim myCell As Range
Dim AllOK As Boolean

AllOK = True

For Each myCell In Range("Headers")
If ActiveWorkbook.Active***.Range(myCell.Address).Value <> myCell.Value Then
MsgBox "Cell " & myCell.Address & " isn't the expected value."
AllOK = False
End If
Next myCell

If AllOK Then MsgBox "All the headers are good."

End Sub

Save that file, but keep it open. Then, open the orthe file, and with that new file active, use
Tools / Macro / Macros... and choose the macro "Compare" (It will be listed with the file name
under which you saved the "Headers" workbook.)

HTH,
Bernie
MS Excel MVP

<nwarn...@xxxxxxxxxxxxx> wrote in message


Bernie,

That rocks -- thanks so much.

Only trivial change was that I've expanded the reference to the named
range so it reads like this:

Workbooks("NEW_ResRF.xls").Sheets("Latest").Range("Headers")

Nj

.


Quantcast