I am trying to write a macro that will start by doing the following:
1 Run in the background when the spreadsheet is opened.
2 Compare a value entered i.e. name in another workbook if it does not exist highlight the fact - ideally would give the option to add it to the workbook.
The overall ambition is to write a resource profile tool that would 'flag' when a resource is over allocated - but help with the above would be a great start.
I've managed to compare values so far but cannot be sure I have looked in all worksheets
Sub checkname()
Dim rCell As Range, vVal1, vVal2
Dim wbCheck As Workbook
For Each rCell In Workbooks("Book2.xlt").Worksheets(1).Range("A1:A5")
vVal1 = rCell
vVal2 = ThisWorkbook.Worksheets(1).Range(rCell.Address)
If vVal1 = vVal2 Then
MsgBox "valid"
MsgBox Worksheets.Count
Debug.Print "The value of variable X is: " & vVal1
Debug.Print " vVal1" & vVal2
End If
Next rCell
End Sub
Its a work in progress, but ideas would be helpful