If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Regarding Excel Macros
Hi,
Am having one excel sheet contains more records(rows as well as columns) say A to z in the specific column i want only A B C in that column Rest all should be deleted along with the Row. Can you pls send the code for this it will be more effective for my official use. |
#2
|
|||
|
|||
Regarding Excel Macros
"Sowparnicka" wrote:
.. say A to z in the specific column i want only A B C in that column Rest all should be deleted along with the Row. Why macro? .. especially when a couple of simple steps using autofilter on a helper col will deliver it in a matter of seconds Let's say that specific col is col A, data in row 2 down In B2: =OR(A2={"A","B","C"}) Copy down to last row of data in col A Apply autofilter on col B choose: FALSE This filters out all the rows to be deleted Select all the filtered rows (select row headers), right-click Delete Row Remove autofilter. Done High five?, click YES below -- Max Singapore http://savefile.com/projects/236895 Downloads:23,500 Files:370 Subscribers:66 xdemechanik --- |
#3
|
|||
|
|||
Regarding Excel Macros
Sub ABConly()
Dim lastrow lastrow = Cells(Rows.Count, "a").End(xlUp).Row For r = lastrow To 1 Step -1 Cells(r, "A").Select If Selection.Value = "A" Then GoTo 100 ElseIf Selection.Value = "B" Then GoTo 100 ElseIf Selection.Value = "C" Then GoTo 100 Else Selection.EntireRow.Delete End If 100 Next r End Sub Vaya con Dios, Chuck, CABGx3 "Sowparnicka" wrote: Hi, Am having one excel sheet contains more records(rows as well as columns) say A to z in the specific column i want only A B C in that column Rest all should be deleted along with the Row. Can you pls send the code for this it will be more effective for my official use. |
Thread Tools | |
Display Modes | |
|
|