Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.newusers
Max Max is offline
external usenet poster
 
Posts: 9,221
Default 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   Report Post  
Posted to microsoft.public.excel.newusers
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 macros - how to merge 5 macros together into one Sue Excel Discussion (Misc queries) 1 April 16th 08 08:36 PM
Macros warning always shows up, even if all macros removed Joe M Excel Discussion (Misc queries) 1 December 20th 07 04:45 AM
Macros - copying macros from one computer to another TT Excel Discussion (Misc queries) 18 December 14th 06 03:24 AM
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM
help with excel (maybe macros) laskuh Excel Worksheet Functions 1 March 20th 05 12:03 PM


All times are GMT +1. The time now is 06:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"