根据标准复制和粘贴

时间:2014-06-05 17:01:56

标签: excel-vba vba excel

我试图创建一个宏,将所有基于标准的单元格向右移动一个。例如。我需要宏移过1,2,3,Sunny,sunny,Cloudy到右边,但只适用于白天。我需要保留完整的年度所有信息。我需要重复多行,

Day#    Decription          Notes
1       Sunny               Bad
2       Sunny               Bad
3       Cloudy              Bad
Year    #   Decription  

理想的解决方案是

Day #   Decription      Notes
    1   Sunny           Bad
    2   Sunny           Bad
    3   Cloudy          Bad
Year    #   Decription  

1 个答案:

答案 0 :(得分:0)

x = 2
Do until Cells(x,1) = "Year"
    Cells(x,4) = Cells(x,3)
    Cells(x,3) = ""
    Cells(x,2) = Cells(x,1)
    Cells(x,1) = ""
    x = x + 1
Loop

不言而喻,但您需要修改列并启动行号以适合您的电子表格。尝试在您的问题中提供更详细的信息,以获得更具体的答案。

相关问题