Excel - Compile error: expected list separator


I am working on a Excel 2003 VB automated routine to remove rows from a worksheet based on a number of variables. My problem is syntax.... As I loop through the rows, I find the top of range of rows to be deleted. I assign a variable called 'top_row' to the entire row, and 'bottom_row' to the entire bottom row.
  • I want to do: rows(top_row:bottom_row).select but I get a compile error: expected list separator or ) one syntax that does work when selecting a given column: range("B" & active_row).select but every idea I can think of for the rows just fails!!!


There are two solutions:

Try rows(top_row & ":" & bottom_row).select

Range(Rows(top_row), Rows(bottom_row)).Select


Thanks to ExcelGuru for this tip on the forum.
Published by aakai1056. Latest update on December 14, 2011 at 04:30 AM by aakai1056.
This document, titled "Excel - Compile error: expected list separator," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).
Excel - Copy data from one sheet to another
Excel – Copy to next blank line