Sub Copy_Data()
Application.ScreenUpdating = False
Worksheets("Weekly formula").Range("C6").Value = Worksheets("Cleaned").Range("b55").Value
Worksheets("Weekly formula").Range("C10").Value = Worksheets("Cleaned").Range("c55").Value
Worksheets("Weekly formula").Range("C8").Value = Worksheets("Cleaned").Range("d55").Value
Worksheets("Weekly formula").Range("C35").Value = Worksheets("Cleaned").Range("b51").Value
Worksheets("Weekly formula").Range("C39").Value = Worksheets("Cleaned").Range("c51").Value
Worksheets("Weekly formula").Range("C37").Value = Worksheets("Cleaned").Range("d51").Value
Worksheets("Weekly formula").Range("C64").Value = Worksheets("Cleaned").Range("b50").Value
Worksheets("Weekly formula").Range("C68").Value = Worksheets("Cleaned").Range("c50").Value
Worksheets("Weekly formula").Range("C66").Value = Worksheets("Cleaned").Range("d50").Value
Worksheets("Weekly formula").Range("C93").Value = Worksheets("Cleaned").Range("b52").Value
Worksheets("Weekly formula").Range("C97").Value = Worksheets("Cleaned").Range("c52").Value
Worksheets("Weekly formula").Range("C95").Value = Worksheets("Cleaned").Range("d52").Value
Worksheets("Weekly formula").Range("C122").Value = Worksheets("Cleaned").Range("b53").Value
Worksheets("Weekly formula").Range("C126").Value = Worksheets("Cleaned").Range("c53").Value
Worksheets("Weekly formula").Range("C124").Value = Worksheets("Cleaned").Range("d53").Value
Worksheets("Weekly formula").Range("C151").Value = Worksheets("Cleaned").Range("b54").Value
Worksheets("Weekly formula").Range("C155").Value = Worksheets("Cleaned").Range("c54").Value
Worksheets("Weekly formula").Range("C153").Value = Worksheets("Cleaned").Range("d54").Value
Worksheets("Weekly formula").Range("C180").Value = Worksheets("Cleaned").Range("b56").Value
Worksheets("Weekly formula").Range("C184").Value = Worksheets("Cleaned").Range("c56").Value
Worksheets("Weekly formula").Range("C182").Value = Worksheets("Cleaned").Range("d56").Value
Worksheets("Weekly formula").Range("C209").Value = Worksheets("Cleaned").Range("b57").Value
Worksheets("Weekly formula").Range("C213").Value = Worksheets("Cleaned").Range("c57").Value
Worksheets("Weekly formula").Range("c211").Value = Worksheets("Cleaned").Range("d57").Value
Application.ScreenUpdating = True
End Sub
我在根据"已清理"设置weekly formula
范围列时遇到问题。工作表单元格H25
。我已经设置好为我想要的列生成正确的字母。我只是不知道将脚本写入此宏。即菜鸟在此,任何帮助非常感谢。
答案 0 :(得分:1)
您可以将H25
读入变量并在范围地址中使用该变量(我使用了Activesheet,但根据您从中获取H25
值的工作表名称进行了更改):< / p>
Sub test()
Dim sourceCol As String
sourceCol = ActiveSheet.Range("H25").Value2
Worksheets("Weekly formula").Cells(209, sourceCol).Value = ........
End Sub
或
Worksheets("Weekly formula").Range(sourceCol & 209).Value