Excel 对表列执行数学运算
我的任务是“优化”电子表格。我有一些代码,可以从csv文件中提取数据,将其转储到工作簿中,然后创建一个表,并对数据执行其他操作。我想知道的是,是否有一种方法可以在只引用标题的情况下对表执行一些简单的除法 例如:Excel 对表列执行数学运算,excel,vba,Excel,Vba,我的任务是“优化”电子表格。我有一些代码,可以从csv文件中提取数据,将其转储到工作簿中,然后创建一个表,并对数据执行其他操作。我想知道的是,是否有一种方法可以在只引用标题的情况下对表执行一些简单的除法 例如: Range("SurveyStaging[[Central Bandwidth Values]:[Bandwidth Values]]").Value = Range("SurveyStaging[[Central Bandwidth]:[Bandwidth]]").Value 不过,
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
抛出类型不匹配
你知道如何做到这一点而不必遍历列中的每个单元格吗
提前感谢您的帮助。您必须根据自己的代码调整行和列,但我认为这会起作用 它不使用循环;它一次操纵整个范围
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
Dim count1为双精度
count1=1
而范围(“A”和CStr(行数+计数1))。值“”
多芬特
count1=count1+1
温德
count1=count1-1
'此计数非常精确,因此需要精确的行数进行操作
范围(“B2”、“B”和CStr(计数1))=“(RC[-1]/RC[-3])”
“你必须把你要除以数字的任何列都放进去
这并不是我想要的,而是我最终使用的。谢谢你,坦曼357。我很感激。