From: Christina on 18 Mar 2010 10:56 I need help with a loop. After looping through the procedure, when the active cell is empty I want to exit the loop. Would you please give me the codes to do that. Thanks Cristina
From: Mike H on 18 Mar 2010 11:04 Christina, Post your loop and someone will help -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Christina" wrote: > I need help with a loop. After looping through the procedure, when the > active cell is empty I want to exit the loop. Would you please give me the > codes to do that. > > > Thanks > > > Cristina
From: Christina on 18 Mar 2010 11:27 Actually I would need it to Exit when there are no more cells with "Vendor ID" Do Range("F:F").Find(What:="Vendor ID", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlDown, _ MatchCase:=False, SearchFormat:=False).Activate ActiveCell.Select ActiveCell.ClearContents ActiveCell.Offset(1, 0).Select Selection.Copy Range(Selection, Selection.End(xlDown)).Select ActiveSheet.Paste Loop Thanks "Mike H" wrote: > Christina, > > Post your loop and someone will help > -- > Mike > > When competing hypotheses are otherwise equal, adopt the hypothesis that > introduces the fewest assumptions while still sufficiently answering the > question. > > > "Christina" wrote: > > > I need help with a loop. After looping through the procedure, when the > > active cell is empty I want to exit the loop. Would you please give me the > > codes to do that. > > > > > > Thanks > > > > > > Cristina
From: Mike H on 18 Mar 2010 11:37 Hi, Try this Sub nn() Dim LastRow As Long Dim MyRange As Range LastRow = Cells(Cells.Rows.Count, "F").End(xlUp).Row Set MyRange = Range("F1:F" & LastRow) For Each c In MyRange If UCase(c.Value) = "VENDOR ID" Then c.ClearContents Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Christina" wrote: > Actually I would need it to Exit when there are no more cells with "Vendor ID" > > Do > > Range("F:F").Find(What:="Vendor ID", After:=ActiveCell, > LookIn:=xlFormulas, _ > LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlDown, _ > MatchCase:=False, SearchFormat:=False).Activate > ActiveCell.Select > ActiveCell.ClearContents > ActiveCell.Offset(1, 0).Select > > Selection.Copy > Range(Selection, Selection.End(xlDown)).Select > ActiveSheet.Paste > > Loop > > > Thanks > > > "Mike H" wrote: > > > Christina, > > > > Post your loop and someone will help > > -- > > Mike > > > > When competing hypotheses are otherwise equal, adopt the hypothesis that > > introduces the fewest assumptions while still sufficiently answering the > > question. > > > > > > "Christina" wrote: > > > > > I need help with a loop. After looping through the procedure, when the > > > active cell is empty I want to exit the loop. Would you please give me the > > > codes to do that. > > > > > > > > > Thanks > > > > > > > > > Cristina
From: Christina on 18 Mar 2010 11:50 Thanks. I am sorry I need step by step instruction. This Do Loop is part of the macro. After the first part is run, then it moves into the LOOP. So where do I put your codes. Do I start with DO, then copy your codes. Sorry for more questions, I am very basic at this. THanks "Mike H" wrote: > Hi, > > Try this > > Sub nn() > Dim LastRow As Long > Dim MyRange As Range > LastRow = Cells(Cells.Rows.Count, "F").End(xlUp).Row > Set MyRange = Range("F1:F" & LastRow) > For Each c In MyRange > If UCase(c.Value) = "VENDOR ID" Then c.ClearContents > Next > End Sub > -- > Mike > > When competing hypotheses are otherwise equal, adopt the hypothesis that > introduces the fewest assumptions while still sufficiently answering the > question. > > > "Christina" wrote: > > > Actually I would need it to Exit when there are no more cells with "Vendor ID" > > > > Do > > > > Range("F:F").Find(What:="Vendor ID", After:=ActiveCell, > > LookIn:=xlFormulas, _ > > LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlDown, _ > > MatchCase:=False, SearchFormat:=False).Activate > > ActiveCell.Select > > ActiveCell.ClearContents > > ActiveCell.Offset(1, 0).Select > > > > Selection.Copy > > Range(Selection, Selection.End(xlDown)).Select > > ActiveSheet.Paste > > > > Loop > > > > > > Thanks > > > > > > "Mike H" wrote: > > > > > Christina, > > > > > > Post your loop and someone will help > > > -- > > > Mike > > > > > > When competing hypotheses are otherwise equal, adopt the hypothesis that > > > introduces the fewest assumptions while still sufficiently answering the > > > question. > > > > > > > > > "Christina" wrote: > > > > > > > I need help with a loop. After looping through the procedure, when the > > > > active cell is empty I want to exit the loop. Would you please give me the > > > > codes to do that. > > > > > > > > > > > > Thanks > > > > > > > > > > > > Cristina
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: pick multiple items in data validation Next: Deleting Duplicates in Excel - Databases |