VBA To return week number? - Excel General - OzGrid.com

文章推薦指數: 80 %
投票人數:10人

VBA To return week number? · Function VBAWeekNum(D As Date, FW As Integer) As Integer · VBAWeekNum = CInt(Format(D, "ww", FW)) · End Function. OzGridFreeExcel/VBAHelpForum HELPFORUMS ExcelGeneral Grasshoppa Student Points 508 Trophies 1 Posts 148 hiall,HasanyoneanyideahowtogetVBAtogivethecurrentweeknumber?IknowicanusetheanalysistoolpakinexcelbutineedthisformI'mcreatingtogivemethecorrectweeknumbereveniftheanalysistoolpakisn'tinstalledonamachine.doesanyoneknowofaworkaround?RegardsGrasshoppa:thanx: BobPhillips Professional Points 3,801 Trophies 1 Posts 1,267 Re:VBAToreturnweeknumber? QuotefromGrasshoppa hiall,HasanyoneanyideahowtogetVBAtogivethecurrentweeknumber?IknowicanusetheanalysistoolpakinexcelbutineedthisformI'mcreatingtogivemethecorrectweeknumbereveniftheanalysistoolpakisn'tinstalledonamachine.doesanyoneknowofaworkaround?RegardsGrasshoppa:thanx: DisplayMore SameasWEEKNUMfunction,notISO?=1+INT((TODAY()-(DATE(YEAR(TODAY()),1,2)-WEEKDAY(DATE(YEAR(TODAY()),1,1))))/7) Grasshoppa Student Points 508 Trophies 1 Posts 148 Re:VBAToreturnweeknumber?Isthereatypointhatpost?VBAkicksitoutas"expected)".I'mnotfamilarwiththeseexpressions!!!!!!!!:thanx:anyhow. Grasshoppa Student Points 508 Trophies 1 Posts 148 Re:VBAToreturnweeknumber?Solvedcortesyof:http://www.cpearson.com/excel/weeknum.htmusethefollowingfunction: Code FunctionVBAWeekNum(DAsDate,FWAsInteger)AsInteger VBAWeekNum=CInt(Format(D,"ww",FW)) EndFunction Barbarr Professional Points 4,409 Trophies 1 Posts 1,441 Re:VBAToreturnweeknumber? QuotefromGrasshoppa Isthereatypointhatpost?VBAkicksitoutas"expected)".I'mnotfamilarwiththeseexpressions!!!!!!!!:thanx:anyhow. Workedfineforme.Maybetherewasapastingerror!!!!!!!!!!!!!!!!!! royUK SuperModerator LikesReceived 770 Points 79,056 Trophies 2 Posts 26,018 OperatingSystem Windows(x64) ExcelVersion Office365 Re:VBAToreturnweeknumber?Bob'ssolutionworksOK,butit'saformulanotVBA,whichiswhatGrasshoppawaslookingfor. Barbarr Professional Points 4,409 Trophies 1 Posts 1,441 Re:VBAToreturnweeknumber? QuotefromroyUK Bob'ssolutionworksOK,butit'saformulanotVBA,whichiswhatGrasshoppawaslookingfor. Ahso,GrasshoppawhichiswhypastingtheExcelformulaintoVBAwouldn'twork.Guessthatoldsaying,"twowrongsdon'tmakearight"istrue.Nicelinkthough. vaasha Beginner Points 3 Trophies 1 Posts 1 Re:VBAToreturnweeknumber?SimplyFormat(Date,"ww") MrFredPret Beginner Points 5 Trophies 1 Posts 1 Re:VBAToreturnweeknumber? Quotefromvaasha;641275 SimplyFormat(Date,"ww") SosimpleThankyouvaasha Share Facebook Twitter Reddit WhatsApp LinkedIn Navigation OzGrid Excel/VBAConsultancy OzGridStore Training Freebies Forum UnresolvedThreads ForumRules Dashboard Articles Members RecentActivities UsersOnline Team SearchMembers Search Options (placeholder) CurrentLocation OzGridFreeExcel/VBAHelpForum HELPFORUMS ExcelGeneral UserMenu Login Registration Thissiteusescookies.Bycontinuingtobrowsethissite,youareagreeingtoouruseofcookies. MoreDetails Close



請為這篇文章評分?