Hi Vishwa, Hope it works for you Sub BlanksAtEnd() Dim rngRange As Range Dim rngStart As Range Dim rngEnd As Range Dim varMonth() As Variant Dim lngLoop As Long Const strDelima As String = "@" Set rngRange = ActiveSheet.UsedRange varMonth = Array("January", "February", "March", "April", "May") For lngLoop = LBound(varMonth) To UBound(varMonth) varMonth(lngLoop) = varMonth(lngLoop) & strDelima & rngRange.Find(varMonth(lngLoop), LookIn:=xlValues).Address Next lngLoop With ActiveSheet For lngLoop = LBound(varMonth) To UBound(varMonth) Set rngStart = .Range(Split(varMonth(lngLoop), strDelima)(1)).Offset(1) If lngLoop < UBound(varMonth) Then Set rngEnd = .Range(Split(varMonth(lngLoop + 1), strDelima)(1)).End(xlUp) ElseIf lngLoop = UBound(varMonth) Then Set rngEnd = .Cells(10000, 1).End(xlUp) End If Set rngRange = .Range(rngStart, rngEnd) rngRange.RemoveDuplicates Columns:=1, Header:=xlNo On Error Resume Next Set rngRange = .Range(.Range(Split(rngRange.SpecialCells(xlCellTypeBlanks).Address, ",")(0)).Offset(1), rngEnd) rngRange.Offset(-1).Value = rngRange.Value On Error GoTo 0: On Error GoTo -1: Err.Clear Next lngLoop End With End Sub Regards, Lalit Mohan
On Wednesday, 27 June 2012 00:46:00 UTC+5:30, Viswanathan Yoganathan wrote: > Hi all, > > > > In the attached excel, I want to delete the week ends whereas at the same > time the position of the month should not move. It means the Feb month > should start from A34, March month should start from A64. Please advise > using VBA macro. > > > > Thanks, > > Vishwa > > "CONFIDENTIALITY NOTICE: This message and any attachment are confidential > and may also be privileged. If you are not the intended recipient of this > e-mail you may not copy, forward, disclose or otherwise use it or any part > of it in any form whatsoever. If you are not the intended recipient please > telephone or e-mail the sender and delete this message and any attachment > from your system." > -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com