Quick help

giddyup

New Member
Joined
Mar 2, 2015
Messages
4
Looking for VBA code to search sheet and find specific text. If found then delete entire column. I also need to be able to cut and paste the entire column (in same sheet) based on text in one cell.

I'm sure this is possible, I tried with FindALL & conditional format formulas, but it just keeps beating me. Any help is appricated!!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I created a macro that creates a pivot table from three things, Employee Names, Training classes, and the hours of each training class. Since columns and rows can change depending on staffing and new trainings, i need it to search for the text (in Row 2) and then either cut and paste the entire column to a standard place (i.e. column B) or delete the entire column. I was able to do this to rows, but i haven't been able to get it to do the same with a column.

Code:
Dim workrange As Range
    Dim Firstrow, Lastrow, lrow As Integer

    Firstrow = ActiveSheet.UsedRange.Cells(1).Row
    Lastrow = ActiveSheet.Range("I60000").End(xlUp).Row
    For lrow = Lastrow To Firstrow Step -1
        Set workrange = Cells(lrow, 9)
        If workrange.Value = "Enrolled" _
           Or workrange.Value = "Not Completed" _
           Or workrange.Value = "In-Progress" _
            Then workrange.EntireRow.Delete
    Next lrow
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,320
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top