[英]If column X contains value, add column Y value to worksheet range
I'm sure this has been answered elsewhere, however I require specific help with the development of the required VBA code.我确信这已经在其他地方得到了回答,但是我需要特定的帮助来开发所需的 VBA 代码。
The scenario: A membership database (worksheet "Members") contains members details including whether they are "Active" or not.场景:成员资格数据库(工作表“成员”)包含成员详细信息,包括他们是否“活跃”。
I am trying to make the program look down Column C;我试图让程序向下看 C 列; if cell contains "ACTIVE" then copy corresponding Column A value to a 2nd worksheet template range, "active members".如果单元格包含“活动”,则将相应的 A 列值复制到第二个工作表模板范围“活动成员”。
Any suggestions will be appreciated.任何建议将不胜感激。
Kind regards.亲切的问候。
This will copy all active users to the second worksheet called Active Members
这会将所有活动用户复制到名为Active Members
的第二个工作表
Sub copyActive()
Dim counter, RowNo As Long
counter = 1
RowNo = 1
Do Until Sheets("Members").Cells(counter, 1) = ""
If UCase(Sheets("Members").Cells(counter, 3)) = "ACTIVE" Then
Sheets("Active Members").Cells(RowNo, 1) = Sheets("Members").Cells(counter, 1)
RowNo = RowNo + 1
counter = counter + 1
End If
counter = counter + 1
Loop
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.