Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Confirming existence of dependents
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Confirming existence of dependents
Pete
Thanks for that - it works fine, but for the fact that if only looks for dependents on the active sheet. Can it be easily extended to look for any dependents across all sheets in the workbook? Cheers Mike "Pete McCosh" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Confirming existence of dependents
Mike,
Pete's solution is elegant and works on dependents in the same sheet. If you want something that looks outside the sheet you can get a 30 day download of my XspandXL add-in from my site below which has a lot of range tracing utilities, including testing precedents/dependents in a range in external sheets. Robin Hammond www.enhanceddatasystems.com "Pete McCosh" wrote in message ... 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Confirming existence of dependents
thanks for your help Pete
Cheers Mike "Pete McCosh" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
co existence | Excel Discussion (Misc queries) | |||
Confirming Vlues in 2 Cells Appear in a List | Excel Worksheet Functions | |||
how to change data in worksheet in text without confirming each s. | Excel Discussion (Misc queries) | |||
Confirming existence of dependents | Excel Programming | |||
Confirming existence of dependents | Excel Programming |