Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete multi columns


Dear all
I have a large amount of data I need to delete all the columns contains
EAS1, EAS2, and EAS3…… so on
How I can do that using VBA
thanks


--
loay
------------------------------------------------------------------------
loay's Profile: http://www.excelforum.com/member.php...o&userid=33721
View this thread: http://www.excelforum.com/showthread...hreadid=535043

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Delete multi columns

Not sure of the condition for deletion. Is it the column contains just one
entry whose first 3 characters are "EAS"? Or must the column contain more
than one? How many? Are these criteria entries always in the same row or
anywhere in the column? HTH Otto
"loay" wrote in message
...

Dear all
I have a large amount of data I need to delete all the columns contains
EAS1, EAS2, and EAS3.. so on
How I can do that using VBA
thanks


--
loay
------------------------------------------------------------------------
loay's Profile:
http://www.excelforum.com/member.php...o&userid=33721
View this thread: http://www.excelforum.com/showthread...hreadid=535043



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Delete multi columns

Sub DeleteColumns()
Dim rng As Range
Set rng = Cells.Find(What:="EAS", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Do
rng.EntireColumn.Delete
Set rng = Cells.FindNext(ActiveCell)
Loop While Not rng Is Nothing
End If
End Sub

Test it on a copy of your workbook

--
Regards,
Tom Ogilvy


"loay" wrote:


Dear all
I have a large amount of data I need to delete all the columns contains
EAS1, EAS2, and EAS3€¦€¦ so on
How I can do that using VBA
thanks


--
loay
------------------------------------------------------------------------
loay's Profile: http://www.excelforum.com/member.php...o&userid=33721
View this thread: http://www.excelforum.com/showthread...hreadid=535043


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete multi columns


The first raw of the sheet will contain the EAS1, EAS2 and EAS3....and
so on as a header 10% of the columns have this header and the hole
column must deleted

Thanks


--
loay
------------------------------------------------------------------------
loay's Profile: http://www.excelforum.com/member.php...o&userid=33721
View this thread: http://www.excelforum.com/showthread...hreadid=535043

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete multi columns

Sub DeleteColumns()
Dim rng As Range
Set rng = Rows(1).Find(What:="EAS", _
After:=Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Do
rng.EntireColumn.Delete
Set rng = Rows(1).FindNext(Range("A1"))
Loop While Not rng Is Nothing
End If
End Sub

--
Regards,
Tom Ogilvy


"loay" wrote in message
...

The first raw of the sheet will contain the EAS1, EAS2 and EAS3....and
so on as a header 10% of the columns have this header and the hole
column must deleted

Thanks


--
loay
------------------------------------------------------------------------
loay's Profile:

http://www.excelforum.com/member.php...o&userid=33721
View this thread: http://www.excelforum.com/showthread...hreadid=535043





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete multi columns


Thanks alot it works very well and solve my problem


--
loay
------------------------------------------------------------------------
loay's Profile: http://www.excelforum.com/member.php...o&userid=33721
View this thread: http://www.excelforum.com/showthread...hreadid=535043

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete multi columns


Dear All

How i can copy the same columns (Contains EAS1,EAS2 and EAS3...) to
another sheet can i use the same VBA macro with some modifys

Regards
Loay


--
loay
------------------------------------------------------------------------
loay's Profile: http://www.excelforum.com/member.php...o&userid=33721
View this thread: http://www.excelforum.com/showthread...hreadid=535043

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete multi columns

Sub DeleteColumns()
Dim rng As Range
Dim rng1 as Range
Set rng = Rows(1).Find(What:="EAS", _
After:=Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Do
if rng1 is nothing then
set rng1 = rng
else
set rng1 = union(rng1,rng)
end if
Set rng = Rows(1).FindNext(Range("A1"))
Loop While Not rng Is Nothing
End If
if not rng1 is nothing then
rng1.EntireColumn.Copy Worksheets("Sheet2").Range("A1")
End if
End Sub

--
Regards,
Tom Ogilvy


"loay" wrote in message
...

Dear All

How i can copy the same columns (Contains EAS1,EAS2 and EAS3...) to
another sheet can i use the same VBA macro with some modifys

Regards
Loay


--
loay
------------------------------------------------------------------------
loay's Profile:

http://www.excelforum.com/member.php...o&userid=33721
View this thread: http://www.excelforum.com/showthread...hreadid=535043



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete multi columns

Disregard that - some more changes needed to be made:

Sub CopyColumns()
Dim rng As Range
Dim rng1 As Range
Set rng = Rows(1).Find(What:="EAS", _
After:=Range("IV1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
sAddr = rng.Address
Do
If rng1 Is Nothing Then
Set rng1 = rng
Else
Set rng1 = Union(rng1, rng)
End If
Set rng = Rows(1).FindNext(rng)
Loop While rng.Address < sAddr
End If
If Not rng1 Is Nothing Then
rng1.EntireColumn.Copy _
Worksheets("Sheet2").Range("A1")
End If
End Sub


--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Sub DeleteColumns()
Dim rng As Range
Dim rng1 as Range
Set rng = Rows(1).Find(What:="EAS", _
After:=Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Do
if rng1 is nothing then
set rng1 = rng
else
set rng1 = union(rng1,rng)
end if
Set rng = Rows(1).FindNext(Range("A1"))
Loop While Not rng Is Nothing
End If
if not rng1 is nothing then
rng1.EntireColumn.Copy Worksheets("Sheet2").Range("A1")
End if
End Sub

--
Regards,
Tom Ogilvy


"loay" wrote in

message
...

Dear All

How i can copy the same columns (Contains EAS1,EAS2 and EAS3...) to
another sheet can i use the same VBA macro with some modifys

Regards
Loay


--
loay
------------------------------------------------------------------------
loay's Profile:

http://www.excelforum.com/member.php...o&userid=33721
View this thread:

http://www.excelforum.com/showthread...hreadid=535043





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
Selecting a subset of data from multi columns Al Excel Discussion (Misc queries) 1 May 7th 08 08:20 PM
Dates split over multi columns in worksheet John Galt Excel Discussion (Misc queries) 6 September 4th 07 09:44 PM
How can I apply If statement using two row, multi columns IF Statement Excel Worksheet Functions 1 February 22nd 07 12:36 AM
If statement using multi columns KReese Excel Worksheet Functions 5 June 2nd 06 02:57 PM
Multi-columns in a ListBox Tom Atkisson Excel Programming 1 October 5th 03 10:27 PM


All times are GMT +1. The time now is 08:36 PM.

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"