Hi,
I am looking for a macro to delete all rows from A1 upto and including a row containing -- Raw Data -- in column A. Any help on this would be greatly appreciated. thanks
Last edited by jhmayor03; 02-02-2012 at 11:26 AM. Reason: solved
Use this code -Option Explicit Dim lrow As Long Dim i As Long Sub del_rows() lrow = Range("A" & Rows.Count).End(xlUp).Row For i = 1 To lrow If Range("A" & i).Value = "Raw Data" Then Rows(1 & ":" & i).Delete Exit For End If Next i End Sub
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
hi jhmayor03, try sort of that:
Sub test() Dim last_range As Range Set last_cell = Range("a1", Cells(Rows.Count, "a").End(xlUp)).Find("-- Raw1 Data --", , xlValues, xlWhole) If Not last_cell Is Nothing Then Application.ScreenUpdating = 0 Range("a1", last_cell).EntireRow.Delete Application.ScreenUpdating = 1 End If End Sub
Thank You works perfectly!!!![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks