资源描述:
《vba example 网页(网页 vba example)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、vbaexample网页(网页VBAexample)Subselectedcolumnsandmergethecolumnadjacentandthesamecontent(cell)DimI,JK,AsDoubleI=ActiveCell.RowK=IJ=ActiveCell.columnApplication.DisplayAlerts=FalseDoUntilCells(I,J)=.Value""IfCells(I+1,J).Value(I,J),Cells.ValueThenRange(Cells(k,J),Cells(I,J).Merge)K=I+
2、1EndIfI=I+1LoopApplication.DisplayAlerts=TrueEndSubDescription:giveyouexamplesofthismethod,recordingamacroinexcel"(inthemodule),custommacroname(hereistakenastheselectedcolumnandthecolumnwiththesamecontentandtheadjacentcell"),thecodeiscopiedintothe.Thespecificmethodofuse:forexampley
3、ouwanttomergecellsintheAcolumnandadjacenttothecontent,selecttheAcolumn,thenthe"tools"-"macro","macro",executeyoujustdefinedmacroscan,ofcourse,youcanalsobuildabuttontoexecutethemacrobyclickingonthebutton.VBAextractthefilenameoperatingproceduresandcodeSource:unknownauthor:unknownedit
4、or:hanphoneworldpublished:09:18click2012-10-30:30WordpptexcelwpsotherinputskillsTheuseofVBAintheexcelcode,allthefilesinafoldercaneasilyextractthenameof.Forexample,theFdiskfollowingtheestablishmentofafolder,thefoldernameis:ITtribenest,nowthinkofallthefileswillbe"ITtribenest"thefolde
5、rnameisextractedinthecurrentsheetC.TheVBAfileextractionoperationisasfollows:1.pressALT+F11toopentheVBEeditor.Theimplementationofthe"2.-insertmodule,insertmodule1.3.ontherightsideoftheeditor,copythecodebelow,andthenclickthegreenarrow"orF5shortcutkeys,operationcode.PrivateSubVBAextra
6、ction(filename)DimFileNameAsStringDimIAsLongFileName=Dir("F:ITtribe*.*nest")I=0Range("C:C").ClearContentsDoWhile>FileName""I=I+1Cells(I,3)=FileNameFileName=DirLoopEndSub4.closetheVBEwindow,backtothetable,canseeintheCcolumnFdisc"ITtribenest"folderallthefilesalllistedintheCcolumn.O
7、ntopoftheVBAfilenamecode,pleaseinactualuse,accordingtotheneedtomodifythepathextractionfilename(F:IT,and*.*tribenest)locationstoredintheCcolumn(Cells(I,3)).WiththespecifieddatavaliditycircletableinExcelSource:unknownauthor:unknowneditor:hanphoneworldpublished:2010-07-18clickonthe2
8、2:24:188Wordpptexcelwpsoth