Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default MACRO every 2nd Coulm want delete in selection

hello,
I want creat a macro which i want use delete my selection every second coulm.

A_col B_col C_col
1
2 <----- want delete
3
4 <------want delete
5
Thanks/Tufail
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default MACRO every 2nd Coulm want delete in selection

Hi Tufail,

Try:
'================
Public Sub Tester()
Dim rng As Range
Dim delRng As Range
Dim i As Long
Dim CalcMode As Long

Set rng = Selection '<<==== CHANGE

On Error GoTo XIT
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

For i = 2 To rng.Rows.Count Step 2
If delRng Is Nothing Then
Set delRng = rng.Rows(i)
Else
Set delRng = Union(rng.Rows(i), delRng)
End If
Next i

If Not delRng Is Nothing Then
delRng.EntireRow.Delete
End If

XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With

End Sub
'<<================


---
Regards,
Norman


"Tufail" wrote in message
...
hello,
I want creat a macro which i want use delete my selection every second
coulm.

A_col B_col C_col
1
2 <----- want delete
3
4 <------want delete
5
Thanks/Tufail



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
How i count coulm by conditon M.K[_2_] Excel Discussion (Misc queries) 2 August 7th 09 08:13 PM
key coulm M.K[_2_] Excel Discussion (Misc queries) 2 March 22nd 09 06:00 PM
key coulm M.K[_2_] Excel Discussion (Misc queries) 1 March 22nd 09 05:23 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Macro data selection line delete Frantic Excel-er Excel Discussion (Misc queries) 0 May 31st 05 11:46 PM


All times are GMT +1. The time now is 04:19 AM.

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

About Us

"It's about Microsoft Excel"