我知道有一种方法可以使这段代码简短而快速,但似乎我太菜鸟了,无法实现它。我有一些合并的单元格(这是一种应该是“标准”的表格,但用户一直在弄乱它,我使用的宏会给出大量错误并且不会收集信息)。到目前为止,我所做的是制作另一段代码,再次打开“标准”表单并填写用户表单中的所有数据。
它就像一个魅力,但现在我厌倦了四处寻找和询问,因为我不知道如何简化它(我知道这对你来说一定很傻,但我不能接受它不能完成的事实 - 也我不能接受“功能强大”的 VBA 必须花费很长时间才能为这么少的东西编写这么多的代码)。
Application.ScreenUpdating = False
ActiveWindow.ActivatePrevious
Workbooks.Open Filename:="...\Standard Formular.xls"
Sheets("Formulaire - Form").Select
ActiveWindow.ActivateNext
Range("E9").Copy
ActiveWindow.ActivatePrevious
Range("E9").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E11").Copy
ActiveWindow.ActivatePrevious
Range("E11").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E13").Copy
ActiveWindow.ActivatePrevious
Range("E13").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E15").Copy
ActiveWindow.ActivatePrevious
Range("E15").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E17").Copy
ActiveWindow.ActivatePrevious
Range("E17").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E19").Copy
ActiveWindow.ActivatePrevious
Range("E19").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("E21").Select
ActiveCell.FormulaR1C1 = Date
ActiveWindow.ActivateNext
Range("E28").Copy
ActiveWindow.ActivatePrevious
Range("E28").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E30").Copy
ActiveWindow.ActivatePrevious
Range("E30").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E32").Copy
ActiveWindow.ActivatePrevious
Range("E32").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E34").Copy
ActiveWindow.ActivatePrevious
Range("E34").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E36").Copy
ActiveWindow.ActivatePrevious
Range("E36").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E38").Copy
ActiveWindow.ActivatePrevious
Range("E38").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E48").Copy
ActiveWindow.ActivatePrevious
Range("E48").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E50").Copy
ActiveWindow.ActivatePrevious
Range("E50").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E52").Copy
ActiveWindow.ActivatePrevious
Range("E52").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E54").Copy
ActiveWindow.ActivatePrevious
Range("E54").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E63").Copy
ActiveWindow.ActivatePrevious
Range("E63").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("G63").Copy
ActiveWindow.ActivatePrevious
Range("G63").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("C65").Copy
ActiveWindow.ActivatePrevious
Range("C65").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("D65").Copy
ActiveWindow.ActivatePrevious
Range("D65").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E65").Copy
ActiveWindow.ActivatePrevious
Range("E65").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("F65").Copy
ActiveWindow.ActivatePrevious
Range("F65").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("G65").Copy
ActiveWindow.ActivatePrevious
Range("G65").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E67").Copy
ActiveWindow.ActivatePrevious
Range("E67").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("A72").Copy
ActiveWindow.ActivatePrevious
Range("A72").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("G72").Copy
ActiveWindow.ActivatePrevious
Range("G72").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
Range("E97").Copy
ActiveWindow.ActivatePrevious
Range("E97").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ActivateNext
ActiveWindow.Close
Application.ScreenUpdating = True
提前感谢您抽出时间来帮助我!