View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Pete McCosh[_5_] Pete McCosh[_5_] is offline
external usenet poster
 
Posts: 59
Default Confirming existence of dependents

Mike,

there is probably a far more elegant solution, but the
following macro will test every entry in column B for
dependents, then fill in column C accordingly.

Sub DependOnIt()

Dim x As Integer

On Error Resume Next

For x = 1 To Application.WorksheetFunction.CountA _
(ActiveSheet.Columns(1))

If IsError(Cells(x, 2).Dependents) Then
Cells(x, 3).Value = "No"
Else
Cells(x, 3).Value = "Yes"
End If

Next x

On Error GoTo 0

End Sub

Cheers, Pete.
-----Original Message-----
I have a long list of 'single point' numerical data items

that a colleague
has extracted from a large written document. This data

has been put into
rows; with column A containiung the data

label/description, and column B
containing the actual data item (be it a general number,

a date, a currency
amount, etc., etc..). I have used many of these elsewhere

within the
workbook, but not all of them so some of the data is

effectively redundant.

Is there an easy way of returning a "Yes" or "No" into

column C, confirming
that the data point has been used elsewhere in the model

(i.e. has
dependents)?

A macro button in the top left of the worksheet that

when run does the
tests and then pastes either a "Yes" or "No" into column

C, as appropriate,
for each row seems to be required, but I do not know what

this would like.

Any help on how to write this would be very much

appreciated.

Thanks

Mike