資源描述:
《excel vba常用技巧代碼》由會員上傳分享,免費在線閱讀,更多相關內容在工程資料-天天文庫。
1、1.刪除重復行12.ActiveX控件的相關操作23.單元格內容匹配24.單元格填充公式35.彈出打開對話框36.操作文件夾下的所有工作簿37.獲取數(shù)據(jù)區(qū)域的最后一行和最后一列48.獲取列的字母順序[A~IV]49.自定義函數(shù)返回數(shù)組并填充至單元格區(qū)域410.繪制曲線圖511.單元格區(qū)域拷貝612.操縱數(shù)據(jù)庫(查、增、刪、改)613.待定XX71.刪除重復行關鍵字:[a65536].End(xlUp).Row、Offset()、相關雙層循環(huán)SubRemoveDuplicate()'刪除重復行Fori=[a65536].End(xlUp
2、).Row-1To1Step-1'按倒敘刪除Forj=[a65536].End(xlUp).RowToi+1Step-1IfCells(i,1).Value=Cells(j,1).ValueThenRows(i).DeleteEndIfNextNextEndSubSubRemoveItem()'刪除相鄰重復,但不刪除隔行重復DimiAsLongWithRange("A2")'以A2為基準進行單元格偏移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控件的相關操作關鍵字:ActiveX、OLEObjects、ActiveSheet.OLEObjects遍歷控件DimcAsObjectForEachcInActiveSheet.OLEObjectsIfc.Name="ComboBox"&iThen'…………..ElseIfc.Name="CheckBox"&iThen'…………..EndIfNextc附件:2.單元格內容匹配關
5、鍵字:ExitFor、.Interior.ColorIndex、互不相關雙層循環(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'當找到有匹配的時候退出,進入下一個記錄查找Else'當找遍所有,但未找到(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.單元格填充公式關鍵字:公式、.Formula、.FormulaR1C1Cells(1,1).Formula="=B1+C1"Cells(2,1).FormulaR1C1="=R