将范围内的所有日期放入数组

时间:2018-12-22 03:50:01

标签: excel vba

我正在尝试将日期范围添加到数组中(请参见代码)。我只能将一个日期(当前日期)放入数组Sub ExportDataWordTable() Dim wdApp As New Word.Application, wdDoc As Word.Document Const stWordDocument As String = "\TESTQUOTE.docm" Dim xlWkBk As Workbook, xlWkSht As Worksheet Set xlWkBk = ThisWorkbook: Set xlWkSht = xlWkBk.Worksheets("Sheet2") 'Here the target document resides in the same folder as the workbook. Set wdDoc = wdApp.Documents.Open(Filename:=xlWkBk.Path & stWordDocument, AddToRecentFiles:=False) 'Copy the used range With xlWkSht .Range("B3:H" & .UsedRange.SpecialCells(xlCellTypeLastCell).Row).Copy End With With wdDoc 'Paste the copied content to the end of the table .Tables(2).Range.Characters.Last.PasteAppendTable 'Save and close the document. .Close True End With 'Close our instance of Microsoft Word. wdApp.Quit 'Clear the clipboard Application.CutCopyMode = False 'Release the external variables from the memory Set wdDoc = Nothing: Set wdApp = Nothing: Set xlWkSht = Nothing: Set xlWkBk = Nothing MsgBox "The data has been transferred to Test.doc", vbInformation End Sub 中。我想要当前范围内的所有日期,包括21/12/2018start

currentdate

0 个答案:

没有答案