Hello World 馃槈
-
砖诇讜诐 讻讜诇诐,
驻注诐 专讗砖讜谞讛 砖讗谞讬 讻讜转讘 讬讜转专 诪讻诪讛 砖讜专讜转 拽讜讚,
诇爪注专讬 讝讛 讘VBA 讜诇讗 讘诪砖讛讜 讬讜转专 诪注谞讬讬谉, 驻砖讜讟 讝讛 诪讛 砖讛讬讬转讬 爪专讬讱专爪讬转讬 诇住谞谉 注诐 讛住诇讬拽专讬诐 砖诇 讗拽住诇 讞讜讚砖 讛谞讜讻讞讬
诪爪专祝 讗转 讛转讜爪讗讛 讛专爪讜讬讛 砖讘"讛 注讜讘讚转
讜讝讛 讛拽讜讚:
Sub 住谞谉_诇讛讬讜诐() '砖诐 讛住诇讬拽专 SlicerMonth = "Slicer_讞讜讚砖2" SlicerYear = "Slicer_砖谞讛2" '讘讬讟讜诇 住讬谞讜谞讬诐 拽讜讚诪讬诐 ActiveWorkbook.SlicerCaches(SlicerMonth).ClearManualFilter ActiveWorkbook.SlicerCaches(SlicerYear).ClearManualFilter '住驻讬专转 驻专讬讟讬诐 讘住诇讬拽专 Dim countSlicerMonth As Integer Dim countSlicerYear As Integer countSlicerMonth = ActiveWorkbook.SlicerCaches(SlicerMonth).SlicerItems.Count - 1 countSlicerYear = ActiveWorkbook.SlicerCaches(SlicerYear).SlicerItems.Count - 1 '讻讬讘讜讬 讻诇 讛驻专讬讟讬诐 Dim i As Integer For i = 1 To countSlicerMonth ActiveWorkbook.SlicerCaches(SlicerMonth).SlicerItems(i).Selected = False Next i For i = 1 To countSlicerYear ActiveWorkbook.SlicerCaches(SlicerYear).SlicerItems(i).Selected = False Next i '讛讙讚专转 讛转讗专讬讻讬诐 Dim myMonth As String Dim myYear As String myMonth = Month(Date) myYear = Year(Date) '讛驻注诇转 讛转讗专讬讻讬诐 ActiveWorkbook.SlicerCaches(SlicerMonth).SlicerItems(myMonth).Selected = True ActiveWorkbook.SlicerCaches(SlicerYear).SlicerItems(myYear).Selected = True End Sub
讛讬讬转讬 砖诪讞 注诐 讛注专讜转 注诇 讛拽讜讚 诪讘讞讬谞转 讛讻诇
讛诪讘谞讛 讛诪转讜讚讜转 讜讻诇 讛砖讗专 砖讗谞讬 诇讗 讬讜讚注 注讚讬讬谉 讗讬讱 拽讜专讗讬诐 诇讝讛
讻讬 讗谞讬 注讚讬讬谉 讘讛转讞诇讛 讜诇讗 专讜爪讛 诇讛砖讗专 注诐 讟注讬讜转转讜讚讛!!
-
谞专讗讛 诪注讜诇讛! 转诪砖讬讱 讻讻讛!
讛讛注专讛 讛专讗砖讜谞讛 讝讛 砖诐 讛诪转讜讚讛. 讗诇 转砖转诪砖 讘注讘专讬转 (注砖讬转 讝讗转 谞讛讚专 讘拽讜讚 注爪诪讜 砖讛讻诇 讘讗谞讙诇讬转).
砖谞讬转, 讛拽讜讚 讛讝讛 诪谞讬讞 拽爪转 讛谞讞讜转. 诇诪砖诇 诇讻讗讜专讛 讛讜讗 讬拽专讜住 讗诐 诪讬砖讛讜 讬谞拽讛 讗转 讛住讬谞讜谞讬诐 (讗谞讬 诇讗 讛讻讬 诪讻讬专 VBA 注诐 讗拽住诇, 讗谞讬 爪讜讚拽?). 诇驻讬 讛住驻专, 讻砖转注砖讛 转讜讻谞讛 诪拽爪讜注讬转 注诇讬讱 诇讚诪讬讬谉 讻诇 转专讞讬砖 讗驻砖专讬 讜诇讛讙讬讘 讘讛转讗诐.讻注转 砖讗诇讜转:
ActiveWorkbook.SlicerCaches(SlicerYear).SlicerItems.Count - 1
诇诪讛 讛诪讬谞讜住 1?
-
@dovid 讗诪专 讘Hello World :
诇诪砖诇 诇讻讗讜专讛 讛讜讗 讬拽专讜住 讗诐 诪讬砖讛讜 讬谞拽讛 讗转 讛住讬谞讜谞讬诐
诇讗 讛讘谞转讬, 讗转讛 诪转讻讜讜谉 讗诐 诪讬砖讛讜 讘讬讟诇 讗转 讛住讬谞讜谉 诇驻谞讬 砖讛驻注讬诇 讗转 讛拽讜讚?
讗诐 讻谉 讛转砖讜讘讛 砖讝讛 诇讗 拽讜专住, 讘砖讜谞讛 诪讘讬讟讜诇 驻讬诇讟专 注诇 讟讘诇讛 注爪诪讛 砖讗讝 讝讛 讗讻谉 拽讜专住 讗诐 讗讬谉 驻讬诇讟专@dovid 讗诪专 讘Hello World :
讻注转 砖讗诇讜转:
ActiveWorkbook.SlicerCaches(SlicerYear).SlicerItems.Count - 1诇诪讛 讛诪讬谞讜住 1?
讻讬 讛转讜爪讗讛 诪砖讜诐 诪讛 讛讬讛 1 讬讜转专 诪诪讛 砖讬砖 讘驻讜注诇,
讗谞讬 讞讜砖讘 砖讝讛 讘讙诇诇 砖讬砖 注讜讚 驻专讬讟 砖讝讛 诪讜住转专 诪讻讬讜讜谉 砖讝讛 专讬拽讜转讜讚讛 注诇 讛注讬讚讜讚!
诪讞讝拽!