Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
do..loop
I would like to compare each cell in column B (which is month) with cell A1
(showing this month). If the text in cell A1 is same as column B, then keep the row. Otherwise, delete the row. I don't what's wrong with below coding!! Anyone can help me or any other good sugguestion? Thank you for your help. Range("B6").Select Do If ACTIVCECELL.Text = Range("A1").Text Then ActiveCell.Offset(1, 0).Select Else Selection.Delete Shift:=xlUp End If Loop Until ActiveCell.Text = "END" |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
do..loop
try:
If ACTIVeCELL= Range("A1") Then "Anna" wrote: I would like to compare each cell in column B (which is month) with cell A1 (showing this month). If the text in cell A1 is same as column B, then keep the row. Otherwise, delete the row. I don't what's wrong with below coding!! Anyone can help me or any other good sugguestion? Thank you for your help. Range("B6").Select Do If ACTIVCECELL.Text = Range("A1").Text Then ActiveCell.Offset(1, 0).Select Else Selection.Delete Shift:=xlUp End If Loop Until ActiveCell.Text = "END" |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
do..loop
For i = Cells(Rows.Count, "B").End(xlUp).Row To 6 Step -1
If Cells(i, "B").Text < Range("A1").Text Then Cells(i, "B").Delete Shift:=xlUp End If Next i -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Anna" wrote in message ... I would like to compare each cell in column B (which is month) with cell A1 (showing this month). If the text in cell A1 is same as column B, then keep the row. Otherwise, delete the row. I don't what's wrong with below coding!! Anyone can help me or any other good sugguestion? Thank you for your help. Range("B6").Select Do If ACTIVCECELL.Text = Range("A1").Text Then ActiveCell.Offset(1, 0).Select Else Selection.Delete Shift:=xlUp End If Loop Until ActiveCell.Text = "END" |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
do..loop
The coding seems delete cells (in column b) but not the entire row!! Would
you please tell me what should I do? Thanks "Toppers" wrote: try: If ACTIVeCELL= Range("A1") Then "Anna" wrote: I would like to compare each cell in column B (which is month) with cell A1 (showing this month). If the text in cell A1 is same as column B, then keep the row. Otherwise, delete the row. I don't what's wrong with below coding!! Anyone can help me or any other good sugguestion? Thank you for your help. Range("B6").Select Do If ACTIVCECELL.Text = Range("A1").Text Then ActiveCell.Offset(1, 0).Select Else Selection.Delete Shift:=xlUp End If Loop Until ActiveCell.Text = "END" |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
do..loop
And to delete the entire row:
For i = Cells(Rows.Count, "B").End(xlUp).Row To 6 Step -1 If Cells(i, "B").Text < Range("A1").Text Then rows(i).Delete End If Next i Bob Phillips wrote: For i = Cells(Rows.Count, "B").End(xlUp).Row To 6 Step -1 If Cells(i, "B").Text < Range("A1").Text Then Cells(i, "B").Delete Shift:=xlUp End If Next i -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Anna" wrote in message ... I would like to compare each cell in column B (which is month) with cell A1 (showing this month). If the text in cell A1 is same as column B, then keep the row. Otherwise, delete the row. I don't what's wrong with below coding!! Anyone can help me or any other good sugguestion? Thank you for your help. Range("B6").Select Do If ACTIVCECELL.Text = Range("A1").Text Then ActiveCell.Offset(1, 0).Select Else Selection.Delete Shift:=xlUp End If Loop Until ActiveCell.Text = "END" -- Dave Peterson |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
do..loop
judging from her code, she didn't want to do that.
-- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Dave Peterson" wrote in message ... And to delete the entire row: For i = Cells(Rows.Count, "B").End(xlUp).Row To 6 Step -1 If Cells(i, "B").Text < Range("A1").Text Then rows(i).Delete End If Next i Bob Phillips wrote: For i = Cells(Rows.Count, "B").End(xlUp).Row To 6 Step -1 If Cells(i, "B").Text < Range("A1").Text Then Cells(i, "B").Delete Shift:=xlUp End If Next i -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Anna" wrote in message ... I would like to compare each cell in column B (which is month) with cell A1 (showing this month). If the text in cell A1 is same as column B, then keep the row. Otherwise, delete the row. I don't what's wrong with below coding!! Anyone can help me or any other good sugguestion? Thank you for your help. Range("B6").Select Do If ACTIVCECELL.Text = Range("A1").Text Then ActiveCell.Offset(1, 0).Select Else Selection.Delete Shift:=xlUp End If Loop Until ActiveCell.Text = "END" -- Dave Peterson |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
do..loop
Yep. But on the follow up to Toppers, she asked how to change his code to
delete the entire row. So I jumped in <bg. Bob Phillips wrote: judging from her code, she didn't want to do that. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Dave Peterson" wrote in message ... And to delete the entire row: For i = Cells(Rows.Count, "B").End(xlUp).Row To 6 Step -1 If Cells(i, "B").Text < Range("A1").Text Then rows(i).Delete End If Next i Bob Phillips wrote: For i = Cells(Rows.Count, "B").End(xlUp).Row To 6 Step -1 If Cells(i, "B").Text < Range("A1").Text Then Cells(i, "B").Delete Shift:=xlUp End If Next i -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Anna" wrote in message ... I would like to compare each cell in column B (which is month) with cell A1 (showing this month). If the text in cell A1 is same as column B, then keep the row. Otherwise, delete the row. I don't what's wrong with below coding!! Anyone can help me or any other good sugguestion? Thank you for your help. Range("B6").Select Do If ACTIVCECELL.Text = Range("A1").Text Then ActiveCell.Offset(1, 0).Select Else Selection.Delete Shift:=xlUp End If Loop Until ActiveCell.Text = "END" -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
DO LOOP in VBA | Excel Discussion (Misc queries) | |||
Do Loop | Excel Worksheet Functions | |||
Do Loop | Excel Worksheet Functions | |||
Do Loop | Excel Worksheet Functions | |||
Do Loop | Excel Worksheet Functions |