+ Reply to Thread
Results 1 to 3 of 3

Printing Selected Rows and Then Deleting Them

  1. #1
    Registered User
    Join Date
    06-07-2012
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    7

    Printing Selected Rows and Then Deleting Them

    hi. my first post but i can imagine it will be the first of many So hello everyone.

    I am trying to look to use a macro to look for data in Col D, print the entire row with said data (e.g. "330") in it and then delete the rows from the workbook but have absolutely no clue where to start.

    Would it be best to run two codes for the printing and then the deleting?

    Thanks for any help

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Printing Selected Rows and Then Deleting Them

    Hi

    Try this:

    trial.xlsm


    Regards...
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Registered User
    Join Date
    06-07-2012
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Printing Selected Rows and Then Deleting Them

    thanks jraj1106 but i made the mistake of running this without even looking at the code like an idiot (massive rush to stop the job at the printer as you can imagine)

    Sub PRINTANDDEL()
    Dim rcnt As Long

    rcnt = Range("D" & Rows.Count).End(xlUp).Row

    For i = 1 To rcnt
    If Range("D" & i).Value <> "330" Then
    Range("D" & i).PrintOut
    Rows(i & ":" & i).Delete
    End If
    Next
    End Sub

    Would i have to alter it as above to look for "330". Sorry for being a pain

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1