資源描述:
《excel vba常用技巧代碼》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫(kù)。
1、1.刪除重復(fù)行12.ActiveX控件的相關(guān)操作23.單元格內(nèi)容匹配24.單元格填充公式35.彈出打開對(duì)話框36.操作文件夾下的所有工作簿37.獲取數(shù)據(jù)區(qū)域的最后一行和最后一列48.獲取列的字母順序[A~IV]49.自定義函數(shù)返回?cái)?shù)組并填充至單元格區(qū)域410.繪制曲線圖511.單元格區(qū)域拷貝612.操縱數(shù)據(jù)庫(kù)(查、增、刪、改)613.待定XX71.刪除重復(fù)行關(guān)鍵字:[a65536].End(xlUp).Row、Offset()、相關(guān)雙層循環(huán)SubRemoveDuplicate()'刪除重復(fù)行Fori=[a65536].End(xlUp
2、).Row-1To1Step-1'按倒敘刪除Forj=[a65536].End(xlUp).RowToi+1Step-1IfCells(i,1).Value=Cells(j,1).ValueThenRows(i).DeleteEndIfNextNextEndSubSubRemoveItem()'刪除相鄰重復(fù),但不刪除隔行重復(fù)DimiAsLongWithRange("A2")'以A2為基準(zhǔn)進(jìn)行單元格偏移DoWhile.Offset(i,0)If.Offset(i,0).Value=.Offset(i-1,0).ValueThen.Off
3、set(i,0).EntireRow.Deletei=i+1LoopEndWithEndSubbeconsistentwithinthesamedisk.Alternateunifiedcorerequirementsplacedontheterminalstripterminals,onlineidentityandensurethecoppercoreisnotexposed.6.4.6enclosurewithinthesametothecablecoreprovidesbindingintoacircle,harnesstie
4、spacingisgenerally100mm;branchofficesshallbebindingonbothends,eachcore1.ActiveX控件的相關(guān)操作關(guān)鍵字:ActiveX、OLEObjects、ActiveSheet.OLEObjects遍歷控件DimcAsObjectForEachcInActiveSheet.OLEObjectsIfc.Name="ComboBox"&iThen'…………..ElseIfc.Name="CheckBox"&iThen'…………..EndIfNextc附件:2.單元格內(nèi)容匹配關(guān)
5、鍵字:ExitFor、.Interior.ColorIndex、互不相關(guān)雙層循環(huán)SubMatch()Dimi,jAsIntegerFori=1To[a65536].End(xlUp).RowForj=1To[b65536].End(xlUp).RowIfCells(i,1).Value=Cells(j,2).ValueThenCells(i,1).Interior.ColorIndex=j+iCells(j,2).Interior.ColorIndex=j+iExitFor'僅匹配第一次EndIfNextjNextiEndSubSub
6、UnMatch()Dimi,jAsIntegerFori=1To[F65536].End(xlUp).RowForj=1To[G65536].End(xlUp).RowIfCells(i,6).Value=Cells(j,7).ValueThenExitFor'當(dāng)找到有匹配的時(shí)候退出,進(jìn)入下一個(gè)記錄查找Else'當(dāng)找遍所有,但未找到(j=循環(huán)上限),給出處理beconsistentwithinthesamedisk.Alternateunifiedcorerequirementsplacedontheterminalstripterm
7、inals,onlineidentityandensurethecoppercoreisnotexposed.6.4.6enclosurewithinthesametothecablecoreprovidesbindingintoacircle,harnesstiespacingisgenerally100mm;branchofficesshallbebindingonbothends,eachcoreIfj=[G65536].End(xlUp).RowThenCells(i,6).Interior.ColorIndex=j+iEnd
8、IfEndIfNextjNexti附件:1.單元格填充公式關(guān)鍵字:公式、.Formula、.FormulaR1C1Cells(1,1).Formula="=B1+C1"Cells(2,1).FormulaR1C1="=R