![]() |
Help with ActiveCell.HasFormula
Hi,
Can anybody suggest a way of getting the following function to work please, or tell me why the one I have shown does not work? I want to loop through a range of cells, and record the cell reference for all cells that contain a formula, or a couple of text strings:- For COL = intStartCol To intEndCol For ROW = intStartRow To intEndRow ActiveCell = Workbooks(strAnalysisFile) _ .Worksheets(strSourceSheet).Cells(ROW, COL) ' If cell contains a formula, this will be an RF ' Also record locations of N/A and Tens If ActiveCell.Value = "N/A" Or ActiveCell.Value = "Tens" _ Or ActiveCell.HasFormula = True Then RfFlag = True i = i + 1 Workbooks(strThisFile).Worksheets("RF_Locations") _ .Cells(i, j) = (ROW & "," & COL) End If Next ROW Next COL By changing "ActiveCell.HasFormula = True" to "Workbooks(strAnalysisFile).Worksheets(strSourceSh eet).Cells(ROW, COL).HasFormula = True" the test works Thanks in advance for your help, Paul. As an extra snippet of info, the address of ActiveCell remains at $A$1 throughout the above loop: which begs the question, why does the loop find all the "N/A" and "Tens" strings, but not the formula? |
All times are GMT +1. The time now is 10:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com