Thursday, August 1, 2019

Excel VBA, finding the row count of a range and applying it to the end of another range

I'm working through a VBA project in Excel (2010 but running in xml, not xmls) and I'm having some troubles. In short, I'm running a =IF((OR(NOT(ISERR(SEARCH....etc in a cell to the very far right of the sheet. Then, I need to xlfilldown, but I need the range to be dynamic. The rows that the IF statement is searching varies from tab to tab, and there is data below it (separated with 1-2 blank rows!) which may contain the same strings i'm searching for, but would provide the wrong data.


So, is it possible to track the row number of the endpoint of the column in the data being IF((OR(NOT(ISERR(SEARCH and then apply that column number as the endpoint of another range, so that the xlfilldown only goes as far as the table? And if so, how would this be done?


Thanks all!!


Range("IF2").Select
ActiveCell.Formula = _
"=IF((OR(NOT(ISERR(SEARCH(""perf"",A24))),NOT(ISERR(SEARCH(""profi"",A24))),NOT(ISERR(SEARCH(""commu"",A24))),NOT(ISERR(SEARCH(""equip"",A24))),NOT(ISERR(SEARCH(""occu"",A24))),NOT(ISERR(SEARCH(""emplo"",A24))),NOT(ISERR(SEARCH(""liqu"",A24))),NOT(ISERR(SEARCH(""withholding"",A24))),NOT(ISERR(SEARCH(""ince"",A24))),NOT(ISERR(SEARCH(""trust"",A24))),NOT(ISERR(SEARCH(""mana"", A24))),NOT(ISERR(SEARCH(""mgmt"", A24))),NOT(ISERR(SEARCH(""incentive"", A24)))))=TRUE, C24, 0)"


I need this to fill-down until the last cell containing anything in A, any ideas?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...