vba编程代码大全

vba编程代码大全 vba打印代码大全?

vba打印代码大全?

vba打印代码大全?

代码:

sub 宏1()

dim p,n,st as worksheet

p=#34c:\\#34 #39文件所在位置,你可能需要修改,没必须是\\

n=dir(p amp #34amp.xls*#34)

do while n#34#34

with workbooks.open(p amp n)

for each st in .sheets

if st.name=#34施工记录#34 or st.name=#34施工记录 (2)#34 or st.name=#34施工记录 (3)#34 then st.printout

next st

.close

end with

n=dir

loop

end sub

vba代码对照表?

vba代码对照表

Dim i

For i = 1 To [A65536].End(xlUp).Row #39先用for循环把A与B列的数据合并到C列

Cells(i, 3) = Cells(i, 1) amp #34_#34 amp Cells(i, 2)

Next i

For i = 1 To [C65536].End(xlUp).Row #39再用for 循环检查C弄数据是否存在重复值

If WorksheetFunction.CountIf([C:C], Cells(i, 3)) gt 1 Then #39用EXCEL公式COUNTIF判断是否有重复值,1为未发现重复,gt1则有重复值

Cells(i, 1).Interior.Color = 255 #39经判断有重复值则将相对应的A列填充为红色

End If

Next i