C# 如何从for循环中获取Excel的单元格范围
我试图获取for循环中指定的值,然后将它们用作从Excel获取的单元格范围。这里出了什么问题C# 如何从for循环中获取Excel的单元格范围,c#,excel,C#,Excel,我试图获取for循环中指定的值,然后将它们用作从Excel获取的单元格范围。这里出了什么问题 List<string> str = new List<string>(); // The follwing increments by 4, and starts at 25 for (int i = 25; i <= lastRow; i += 4) // += means a + b { st
List<string> str = new List<string>();
// The follwing increments by 4, and starts at 25
for (int i = 25; i <= lastRow; i += 4) // += means a + b
{
str = ws.Range["B"+i].Value;
}
) 我认为你的问题应该澄清,但这可能会有帮助:
for (int i = 25; i <= lastRow; i += 4) // += means a + b
{
string cellName = "B" + i.ToString();
string cellValue = (string)ws.Range[cellName].Value;
str.Add(cellValue);
}
for(int i=25;i是ws a列表的值
?你能详细说明你的问题是什么吗?我不明白你想达到什么目的
for (int i = 25; i <= lastRow; i += 4) // += means a + b
{
string cellName = "B" + i.ToString();
string cellValue = (string)ws.Range[cellName].Value;
str.Add(cellValue);
}