Re: $$Excel-Macros$$ Ask for improvement for procedure for date filling

2012-05-17 Thread Darwin Chan
Dear all, Thanks for your help! 2012/5/17 dguillett1 > Sub dates() > days = Day(DateSerial(Year(Date), myMonth + 1, 1) - 1) > MsgBox days > Set myrange = Range("b1: b”& days) > With myrange.Cells(1) > .Value = DateSerial(Year(Date), Month(Date), 1) > .AutoFill Destination:=myrange, Type:=xl

Re: $$Excel-Macros$$ Ask for improvement for procedure for date filling

2012-05-17 Thread dguillett1
Sub dates() days = Day(DateSerial(Year(Date), myMonth + 1, 1) - 1) MsgBox days Set myrange = Range("b1: b”& days) With myrange.Cells(1) .Value = DateSerial(Year(Date), Month(Date), 1) .AutoFill Destination:=myrange, Type:=xlFillDays End With End Sub Don Guillett Microsoft MVP Excel SalesAid Softwa

RE: $$Excel-Macros$$ Ask for improvement for procedure for date filling

2012-05-17 Thread Rajan_Verma
Hi, First you Can give Name ranges instead of Static Range like B1:B31 Second : You can create a Function for these lines to reduce the Lines from your code With myrange.Cells(1) .Value = DateSerial(Year(Date), month(Date), 1) .AutoFill Destination:=myrange, Type:=xlFi