Copy entire column if column title matches
Closed
Bethany2727
-
Sep 24, 2009 at 10:24 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Sep 24, 2009 at 10:08 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Sep 24, 2009 at 10:08 PM
Related:
- Copy entire column if column title matches
- Excel copy column from one sheet to another automatically - Guide
- Netflix title request - Guide
- Sum column if another column equals ✓ - Excel Forum
- Excel count how many times a value appears in a column ✓ - Office Software Forum
- Search entire workbook excel formula ✓ - Excel Forum
1 response
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Sep 24, 2009 at 10:08 PM
Sep 24, 2009 at 10:08 PM
suppose that column headings (labels) are in row no 1 frrm A1 to right
in that case try ths macro (modify if necessary)
confirm if macro does what you want.
mine is exscel 2002 version
in that case try ths macro (modify if necessary)
confirm if macro does what you want.
Sub test() Dim del() As Range, rng As Range, j As Integer, k As Integer Dim add As String On Error Resume Next Worksheets("sheet1").Activate Set rng = Range(Range("A1"), Range("A1").End(xlToRight)) j = WorksheetFunction.CountIf(rng, "delete") ReDim del(1 To j) k = 1 Set del(k) = rng.Cells.Find(what:="delete", lookat:=xlWhole) If del(k) Is Nothing Then Exit Sub add = del(1).Address MsgBox del(k).Address k = k + 1 Do Set del(k) = rng.Cells.FindNext(after:=del(k - 1)) If del(k) Is Nothing Then GoTo line1 If del(k).Address = add Then GoTo line1 MsgBox del(k).Address k = k + 1 Loop line1: k = 0 For k = j To 1 Step -1 del(k).EntireColumn.Delete Next k End Sub
mine is exscel 2002 version