A few words of thanks would be greatly appreciated.

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.

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Published by . Latest update on 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/).