复制一行中的特定单元格并粘贴在另一张纸上,在下一行重复,直到下一行的单元格为空白

时间:2019-01-30 20:05:33

标签: excel vba

已编辑:19/2/2

我仍在努力理解这一点。我做了一些阅读,意识到自己走错了路。我在下面创建了一个更好的解释,以说明我要做什么。我需要您的帮助,以执行步骤1-2,步骤4-5和步骤7-9。 感谢您的耐心配合和谅解!

Sub Weeder_Repeater()
'
' 1) Copy Columns "D:L" Starting at Line 4 from Candidate Weeder sheet
' 2) Special Paste, Values, Transpose, to Metal Powder Bed AM Calculator sheet Cell "Q6"
' 3) Call Weeder_RAPID_Cal macro
' 4) Copy solution from Metal Powder Bed AM Calculator sheet Cell "Q15"
' 5) Special Paste, Values to Candidate Weeder sheet Column "O"
' 6) Call Weeder_RAPID_Reset macro
' 7) Move to next line in Candidate Weeder sheet
' 8) Repeat Steps 1-7
' 9) End when Blank in Column "D" encountered
'

'Step 1-2


'Step 3
    Call Weeder_RAPID_Calc

'Step 4-5


'Step 6
    Call Weeder_RAPID_Reset

'Step 7-9


End Sub

1 个答案:

答案 0 :(得分:0)

'指定超出范围的数据

对于计数器= 3到10000

'Conditions that you can change it. in the bellow codes (counter) is your cell number and the number after comma is your column index. you can also do not specify your column and only loop through cells. you can also use from (i,j) for looping through both cells and columns (means two (For) loops).

如果Worksheets(“ 2nd QC”)。Cells(counter,2).Value

工作表(“第二个质量控制”)。行(计数器)。Interior.Color= 65535

其他    工作表(“第二个质量控制”).Cells(计数器)。值=工作表(“第二个质量控制”).Cells(计数器)。值

如果结束

下一个柜台

'退出循环示例:

Sub ExitStatementDemo()

Dim I,MyNum

Do                ' Set up infinite loop.

    For I = 1 To 1000    ' Loop 1000 times.

        MyNum = Int(Rnd * 1000)    ' Generate random numbers.

        Select Case MyNum    ' Evaluate random number.

            Case 7: Exit For    ' If 7, exit For...Next.
            Case 29: Exit Do    ' If 29, exit Do...Loop.
            Case 54: Exit Sub    ' If 54, exit Sub procedure.
        End Select
    Next I
Loop

结束子

'希望对您有帮助