Dynamic Range Formula or Non Contiguous Single Column Based on Value of 2nd Column?

drew.j.harrison

Board Regular
Joined
Jul 9, 2010
Messages
65
After trying a few options and searching for the last couple hours can't seem to find a way to have a dynamic range that will select the cells in Column B if the corresponding value in Column A is equal to a specific value ("Y"). Any info on how I could accomplish this is appreciated. FYI, I am generating the dynamic range specifically to identify cells to clear the values from in a macro. Thanks.

Cross Post on ExcelForum
 
Last edited:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Why not just do it all in the macro
Code:
Sub drew_j_harrison()
   With Range("A2", Range("A" & Rows.Count).End(xlUp))
      .Replace "Y", "=xxxY", xlWhole, , False, , False, False
      .SpecialCells(xlFormulas, xlErrors).Offset(, 1).Value = ""
      .Replace "=xxxY", "Y", xlWhole, , False, , False, False
   End With
End Sub
 
Upvote 0
I suppose I could use a macro to do it all but was leaning toward a dynamic named range if possible to reduce the risk would have to modify the macro if I modify the table layout later. I tried the macro above but get an error 400 for some reason.

From what I can tell that macro is supposed to replace all the "Y" in column A with an "xxxY", then replaces all of the cells offset 1 to those cells (column B) with "", then goes back to column A and replaces the "xxxY" with "Y".

If that is the case then that would not work either as the "Y" is actually the result of a formula in column A's cells.
 
Upvote 0
Unfortunately I do not know how to create a dynamic named range along those lines.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top