在表格列上执行math运算

我负责“优化”电子表格。 我有一些代码从csv文件中提取数据,将其转储到工作簿中,然后创build一个表格并执行其他一些数据。 我想知道的是,如果有一种方法来执行,比方说,在表中简单的划分,而只引用标题。

例:

Range("SurveyStaging[[Central Bandwidth Values]:[Bandwidth Values]]").Value = Range("SurveyStaging[[Central Bandwidth]:[Bandwidth]]").Value 

工作得很好,但是:

 Range("SurveyStaging[District]").Value = Range("SurveyStaging[Central Bandwidth]").value/Range("SurveyStaging[School Bandwidth]").Value 

引发types不匹配。

任何想法如何做到这一点,而不必循环通过列中的每个单元格?

提前感谢您的帮助。

你将不得不适应你自己的代码的行和列,但我认为这将工作。

它不使用循环; 它一次操纵整个范围。

 Dim count1 As Double count1 = 1 While Range("A" & CStr(RowNumber + count1)).Value <> "" DoEvents count1 = count1 + 1 Wend count1 = count1 - 1 'the count is so that it takes an accurate number of rows to manipulate Range("B2", "B" & CStr(count1)) = "=(RC[-1]/RC[-3])" ' you will have to put in whatever columns you'll be dividing with their NUMBER