+ Reply to Thread
Results 1 to 12 of 12

Delete rows without a specific value in a cell

  1. #1
    Registered User
    Join Date
    04-09-2008
    Posts
    16

    Delete rows without a specific value in a cell

    Hi guys,

    I have a problem that I hope you can help me with!

    I have 2 spreadsheets of delivery information. Sheet 1 contains data of all stores in the UK with addresses. Sheet 2 containts contacts of all stores that promotional matrial needs to be sent to.

    The only common cell in a column of 4 digit store numbers.

    I need to delete all rows from sheet 1 that do not contain a value in the store number column that is displayed on sheet 2.

    Hope that makes sense.

    ps

    for forum moderators or regular posters, where does your knowledge of Excel come from? Is it experience, or are there books / courses you can reccommend?

    Many thanks,

    Chris

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Something like this

    Please Login or Register  to view this content.
    There are numerous books & courses, I learn by experience - posting on Forums & making my own projects work.l
    Last edited by royUK; 06-02-2008 at 08:45 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    04-09-2008
    Posts
    16
    Hi Roy,

    Thanks for you response.

    I think you overestimate my understanding of macros in Excel!!

    If the common cells are in column E, what would the code be?

    I apologise for the ignorance, but when it comes to coding it might as well be written in ancient Greek backwards!!

    Thanks!

    Chris

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this, but use a copy of your workbook
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-09-2008
    Posts
    16
    Thanks again Ry,

    I'm sure it's just me but the macro didn't work for me. I hadn't given you this infomration before, don't know if it's relevant.

    Sheet 1 contains 276 rows of data. The column headings are:
    a = Territory / b = area / c = category / d = store number / e = stre number / f = address / g = telephone number / h = speed dial / i = fax / j = email address / k = store email / l = opening hours.

    Sheet 2 contains 96 rows of data. The column headings are:
    a = first name / b = surname / c = email / d = postcode / e = store number

    The only common column is "store number". I want to finish with 96 rows of data on sheet 1 that marry up to the sotre number on sheet 2, sa they hav relevant elivery information, and I want to perform a mail merge.

    Thanks again!

    Chris

  6. #6
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Hi Chriss,

    Do your sheets have header rows in them?
    Last edited by SOS; 06-03-2008 at 06:27 AM.
    Hope this helps

    Seamus

  7. #7
    Registered User
    Join Date
    04-09-2008
    Posts
    16
    Hi SOS,

    They do indeed have headers. Will this bve a problem?

    I apologise again for my ignorance in this area!!!

    Chris

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The code that i gave you will only work if yo have those specific sheets. Can you add a zipped example workbook

  9. #9
    Registered User
    Join Date
    04-09-2008
    Posts
    16
    I have attached an example of the spreadsheet. These contain the column headings as they appear, but I have deleted the rows as they contain contact details (numbers, email addresses etc.).

    I have added 1 row of data entry on each sheet. Will this be ok? As I mentioned there will actually be 276 rows of entry in sheet 1 and 97 rows o entry in sheet 2.

    Thanks for your continued help!
    Attached Files Attached Files

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I've amended the code and put some notes in.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    04-09-2008
    Posts
    16
    Thanks so much Roy, that works perfectly!

    Thanks again for your continued help & patience, I owe you a drink!

    Chris

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Thanks for letting me know.

    I could retire if I had a £1 for every virtual drink I've been offered. (LOL)

+ 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