当前位置:首页 > 教育综合 > 正文

求写VBA代码,要求如图所示

求帮忙写个VBA代码,跪求

Sub 二个字() Dim Arr, Brr, i&, j&, l&, Crr(), N& With ActiveSheet Arr = .Range(.Cells(2, "A"), .Cells(.Rows.Count, "A").End(xlUp)) Brr = .Range(.Cells(2, "B"), .Cells(.Rows.Count, "B").End(xlUp)) N = UBound(Arr) * UBound(Brr) + 9 ReDim Crr(1 To N, 1 To 1) l = 0 For i = 1 To UBound(Arr) For j = 1 To UBo

请编写VBA代码,如下图片要求:谢谢!

Subtest()
DimDicAsObject,i,arr,rgAsRange,mary
Setrg=Application.InputBox("选择数据范围","源数据选择",,,,,,8)
mary=rg':arr=rg
SetDic=CreateObject("scripting.dictionary")
Fori=UBound(mary,1)To3Step-1
Dic(mary(i,1)&mary(i-1,1)&mary(i-2,1))=Dic(mary(i,1)&mary(i-1,1)&mary(i-2,1))+1
Next
Fori=UBound(mary,1)To3Step-1
mary(i,1)=Dic(mary(i,1)&mary(i-1,1)&mary(i-2,1))
Next
mary(1,1)="":mary(2,1)=""
rg.Offset(0,1)=mary
EndSub

在excel中,一个文件中有三个工作表,如下图,VBA代码应该怎么写?

K2 =IF(J2="","",J2+N(K1)) M2 =IF(L2="","",L2+N(M1)) 下拉既可,不需要VBA代码

求帮忙写VBA代码

Sub 组合两字的名字()

Dim i%, s%

For i = 2 To 5

For s = 2 To 8

Range("D" & Rows.Count).End(3).Offset(1, 0) = Range("A" & i) & Range("B" & s)

Next

Next

MsgBox "处理完毕!", , "提示"

End Sub


Sub 组合三字的名字()

Dim i%, s%, g%

For i = 2 To 5

For s = 2 To 8

For g = 2 To 8

If s <> g Then

Range("E" & Rows.Count).End(3).Offset(1, 0) = Range("A" & i) & Range("B" & s) & Range("B" & g)

End If

Next

Next

Next

MsgBox "处理完毕!", , "提示"

End Sub

在excel2003中,请编写VBA代码如下图片中的要求,谢谢!

Subttt()
DimsRangeAsRange,rAsRange
Dims$,a,i%
SetsRange=Selection
IfsRange.Cells.Count=1Then
MsgBox"请选择查找范围!"
ExitSub
EndIf

s=InputBox("请输入数字区间(格式:80-90):")
a=Split(s,"-")
n1=CInt(Trim(a(0)))
n2=CInt(Trim(a(1)))

s=""
Fori=n1Ton2
s=s&","&i
Next

ForEachrInsRange
s=Replace(s,","&r,"")
Next

a=Split(s,",")
Setr=sRange.Cells(1,1).Offset(-2,0)
Fori=1ToUBound(a)
r=a(i)
Setr=r.Offset(-1,0)
Next
EndSub
展开全文阅读