嫒美直播免费版app下载-嫒美直播永久免费版下载-嫒美直播最新下载安装

當(dāng)前位置:首頁 > 教育綜合 > 正文

求寫VBA代碼,要求如圖所示

求幫忙寫個(gè)VBA代碼,跪求

Sub 二個(gè)字() 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("選擇數(shù)據(jù)范圍","源數(shù)據(jù)選擇",,,,,,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中,一個(gè)文件中有三個(gè)工作表,如下圖,VBA代碼應(yīng)該怎么寫?

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("請輸入數(shù)字區(qū)間(格式: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
展開全文閱讀