New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

Help me on this

Macros, VBA, Excel Automation, etc.

Re: Help me on this

Postby Kranthi » Fri Jan 29, 2016 8:54 am

Hi dude,

Please help me on this. I can finish it.

Thanks,
Kranthi
  • 0

Kranthi
Rookie
 
Posts: 15
Joined: Dec 31, 2015
Reputation: 0
Excel Version: 2007

Re: Help me on this

Postby NoSparks » Fri Jan 29, 2016 2:33 pm

Sorry there buds,

I must have been signed into the forum at the time you posted that file 'cause I never received notification of the posting to the thread.

when i run all three macros at once i am not getting output of third macro.... If i run "Lot" macro separately then i am getting the output.

that's because your second macro ends leaving Sheet3 as the active sheet.
Put Sheets("W R").Select as the first line of code to execute in Sub Lot()

Code: Select all
Sub Lot()
    Dim rng As Range, cel As Range
    Dim ThisDay As Date, LastDay As Date
    Dim curLot As Integer
   
Sheets("W R").Select
Set rng = Sheets("W R").Range("F2:F" & Cells(Rows.Count, 6).End(xlUp).Row)
For Each cel In rng
    If cel.Offset(0, 2).Value = "" Then ThisDay = cel.Value
    If ThisDay <> LastDay Then curLot = curLot + 1
    If cel.Offset(0, 2) = "" Then cel.Offset(0, 2).Value = "Lot-" & curLot
    LastDay = ThisDay
Next cel
End Sub
  • 0

NoSparks
Excel Hobbyist
 
Posts: 637
Joined: May 28, 2014
Reputation: 103
Excel Version: 2010

Re: Help me on this

Postby Kranthi » Sun Jan 31, 2016 1:07 am

That's OK buddy.

U made my day. Thank you. I am done with the task.

Thank you so much dude for your valuable time and making me understand macros, which really helped me to automate my routine tasks.
  • 0

Kranthi
Rookie
 
Posts: 15
Joined: Dec 31, 2015
Reputation: 0
Excel Version: 2007

Previous

Return to Macros and VBA Questions

Who is online

Users browsing this forum: Google [Bot] and 16 guests

cron