0
我有以下VBA腳本:VBA識別多個單元格被突出顯示
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
If Not Application.Intersect(Target, Range("calendar")) Is Nothing Then
[selectedCell1] = ActiveCell.Value
Application.ScreenUpdating = True
End If
End Sub
目前,它只能識別一個單元被突出顯示,並返回到名爲selectedCell1特定小區。
如果我選擇包含日期「2017年3月8日」返回「2017年3月8日」到一個名爲「selectedCell1」另一片小區的小區N25。
但是我想做的事情是意識到我選擇了整整一週,然後在單元格「selectedCell1」中返回整個星期的範圍。參見:
然後在單元格「selecetedCell1」中返回01/08/2017 - 05/08/2017(表示整個範圍)。
不知道如何調整這個VBA腳本。幫助將不勝感激。謝謝。
'[selectedCell1] .Resize(Target.Rows.Count,Target.Columns.Count)= Target.Value'不要使用ActiveCell :) –