I have a code for a department calendar so when you select a week number and click a button, it autofills the schedule for the week. It works great and my boss loves it, but because it uses relative referencing, it will create little autofill disasters if the wrong cell is selected.
I'm looking for a code that will limit it to only work when specific cells are selected:
(B4, B15, B26, B37, B48, B59, B70, B81, B92, B103, B114, B125, B136, B147, B158, B169, B180, B191, B202, B213, B224, B235, B246, B257, B268, B279, B290, B301, B312, B323, B334, B345, B356, B367, B378, B389, B400, B411, B422, B433, B444, B455, B466, B477, B488, B499, B510, B521, B532, B543, B554, B565, B576)
Here's the code I have now:
Sub FillSelectedWeek()
'
' FillSelectedWeek Macro
'
'
ActiveCell.Offset(2, 1).Range("A1:A8").Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:F8"), Type:= _
xlFillValues
ActiveCell.Range("A1:F8").Select
ActiveCell.Offset(0, 1).Range("A1:E8").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
End Sub
I found an earlier thread with a similar problem, but not quite close enough for my simple mind to connect the dots:
http://www.excelforum.com/excel-prog...-selected.html
Thanks in advance for any help you awesome people can give.
Bookmarks