如果D列中的值是“Arch”,则将数据从一个工作表复制到另一个工作表。 [英] To copy data from one sheet to another if value in column D is "Arch"

查看:57
本文介绍了如果D列中的值是“Arch”,则将数据从一个工作表复制到另一个工作表。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想将不同工作表中的整行复制到主工作表(追踪器),如果找到不同工作表的D列中的值作为拱门。整行应该复制到主页(跟踪器)。

任何帮助表示感谢。



以下是我的代码:



Hi,

I wanted to copy entire row from different sheets to a Main sheet (Tracker), if value in column "D" of different sheets is found as "Arch". The entire row should be copied to Main sheet(Tracker).
Any help appreciated.

Below is my code:

Sub test1()

Dim strLastRow As String
    Dim rngC As Range
    Dim strToFind As String, FirstAddress As String
    Dim wSht As Worksheet
    Dim rngtest As String
    Application.ScreenUpdating = False

    Set wSht = Worksheets("Tracker")
    strToFind = InputBox("Enter the Action Item On")

    With ActiveSheet.Range("A1:AY23331")
        Set rngC = .Find(what:=strToFind, LookAt:=xlPart)
            If Not rngC Is Nothing Then
                FirstAddress = rngC.Address
                Do
                    strLastRow = Worksheets("Tracker").Range("A" & Rows.Count).End(xlUp).Row + 1

                    rngC.EntireRow.Copy wSht.Cells(strLastRow, 1)
                   Set rngC = .FindNext(rngC)
                Loop While Not rngC Is Nothing And rngC.Address <> FirstAddress

            End If
    End With

    MsgBox ("Finished")

End Sub





我尝试使用此代码从一张纸复制到另一张纸并且它正在运行,但有一个问题是它复制了最后一张在Tracker中找到两次值行。



在此我已在一张纸上添加了提交按钮,以检查跟踪工具表是否正在更新。

现在我想要相反的情况即。代码应该检查工作簿中存在的所有工作表并更新主页(跟踪器),在D列中找到值Arch。



问候,

Archie



I tried this code for copying from one sheet to another and it is working but with one issue that it copies the last found value row twice in Tracker.

In this i have added submit button on one sheet to check if Tracker sheet is getting updated or not.
Now i want the reverse case ie. code should check for all worksheets present in workbook and update the Main sheet (Tracker) whereever value "Arch" is found in Column D.

Regards,
Archie

推荐答案

在这里你得到了答案:帮助解决与...结束的块相关的vba错误 [ ^ ]
Here you got your answer: Help in solving vba error related to with .. end with block[^]


这篇关于如果D列中的值是“Arch”,则将数据从一个工作表复制到另一个工作表。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆