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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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