Excel - Compile error: expected list separator

October 2016


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.

Related :

This document entitled « Excel - Compile error: expected list separator » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.