Excel - Compile error: expected list separator

September 2017




Issue


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!!!

Solution


There are two solutions:

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

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

Note


Thanks to ExcelGuru for this tip on the forum.

Related

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 (ccm.net).