Hello,
I need a macro that will delete rows based on a value in a specific column. I know this is not an uncommon code, but so far nothing I've found has worked with the little variations I have:
1) I want the number threshold on which to delete the rows to be a cell reference (i.e. so the user can change it based on what they want to see).
2) It would be an absolute value threshold (as in, if the user puts 100, it would delete all rows with a value of -100 to 100 in column B)
3) I need the first 2 rows to be ignored (they have titles, headers, etc, but the data is NOT formatted as a table).
I realize this is a specific request, so thank you so much for the help!
Edit:
This seems to be a good starting point, just doesn't do absolute value or ignore the first rows:
I need a macro that will delete rows based on a value in a specific column. I know this is not an uncommon code, but so far nothing I've found has worked with the little variations I have:
1) I want the number threshold on which to delete the rows to be a cell reference (i.e. so the user can change it based on what they want to see).
2) It would be an absolute value threshold (as in, if the user puts 100, it would delete all rows with a value of -100 to 100 in column B)
3) I need the first 2 rows to be ignored (they have titles, headers, etc, but the data is NOT formatted as a table).
I realize this is a specific request, so thank you so much for the help!
Edit:
This seems to be a good starting point, just doesn't do absolute value or ignore the first rows:
Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit;">[COLOR=#00008B]Sub[/COLOR] DeleteRows() Application.ScreenUpdating = [COLOR=#800000]False[/COLOR] Application.Calculation = xlCalculationManual [COLOR=#00008B]Dim[/COLOR] i [COLOR=#00008B]As[/COLOR] [COLOR=#00008B]Long[/COLOR] [COLOR=#00008B]For[/COLOR] i = Range([COLOR=#800000]"A"[/COLOR] & Rows.Count).[COLOR=#00008B]End[/COLOR](xlUp).Row [COLOR=#00008B]To[/COLOR] [COLOR=#800000]1[/COLOR] [COLOR=#00008B]Step[/COLOR] -[COLOR=#800000]1[/COLOR] [COLOR=#00008B]If[/COLOR] [COLOR=#00008B]Not[/COLOR] (Range([COLOR=#800000]"C"[/COLOR] & i).Value < [COLOR=#800000]5000[/COLOR]) [COLOR=#00008B]Then[/COLOR] Range([COLOR=#800000]"C"[/COLOR] & i).EntireRow.Delete [COLOR=#00008B]End[/COLOR] [COLOR=#00008B]If[/COLOR] [COLOR=#00008B]Next[/COLOR] i Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = [COLOR=#800000]True[/COLOR] </code></pre>[COLOR=#00008B][FONT=Consolas]End[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] [/FONT][/COLOR][COLOR=#00008B][FONT=Consolas]Sub[/FONT][/COLOR]
Last edited: