lzth.net
当前位置:首页 >> vBA中如何用双循环判断两列单元格的内容是否相等 >>

vBA中如何用双循环判断两列单元格的内容是否相等

for i=2 to 5 for j=2 to 5 if cells(i,2)=cells(j,3) then cells(i,3)= cells(i,2)*cells(j,3) end if next next 你这样是用B列和C列对比,不是同行对比哦, 如果是要同行对比,代码改为如下 for i=2 to 5 if cells(i,2)=cells(i,3) then cells...

dim arr,i&,j&,irow%irow=activecell.rowredim arr(1 to 21,1 to 7)for i =1 to 21 for j=1 to 7 arr(i,j)=sheet4.cells(irow,(i-1)*7+9) nextnextarr 这个两维数组,每行是一产品的信息,列表头分别是类别、品牌、型号。。。。等 赋 值给表时,...

Sub cfkj() Dim i As Integer, j As Integer Dim sz(1 To 9, 1 To 9) For i = 1 To 9 For j = 1 To i sz(i, j) = j & "*" & i & "=" & i * j Next j Next i Range("A1:i9") = sz() End Sub

Private Sub CommandButton1_Click() Dim Arr() Dim Brr() As String Dim lEndRow As Long Dim bFinded As Boolean Dim i As Long Dim j As Long lEndRow = Range("A65536").End(xlUp).Row If lEndRow = 1 Then Range("D1") = Range("A1") Exit ...

循环里面还套了一层循环吧

Sub s() arr = [a1:a13] ReDim brr(1 To 1) brr(1) = arr(1, 1) k = 1 For i = 2 To UBound(arr) For j = 1 To k If arr(i, 1) = brr(j) Then GoTo nexti Next k = k + 1 ReDim Preserve brr(1 To k) brr(k) = arr(i, 1)nexti: Next [d1].Resize...

双线?在哪,没有看到呢,是什么样的?

MyName = "A" & i & j

网站首页 | 网站地图
All rights reserved Powered by www.lzth.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com