+ Reply to Thread
Results 1 to 3 of 3

Trouble with macro (empty and nonempty cells)

  1. #1
    Registered User
    Join Date
    10-07-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    Excel 2007
    Posts
    2

    Post Trouble with macro (empty and nonempty cells)

    Hi,
    I have a trouble with macro.

    In column A I have risk factors ("Czynniki narażeń"), in column B I choose if that risk factor exist or not ("Zaznaczone"; Yes ("Tak") or No ("Nie")), column D shows necessary medical examinations ("K/B") and column E shows preparation ("Przygotowanie") for an examination.

    I'd like to (After column D shows data and before column E shows data):
    1. remove duplicates in column D (I found something [remove.duplicates] but it doesn't work)
    2. remove empty cells in column D (but not rows) - I have an idea but I don't know how to do it:
    -find last non empty cell in range d7:d16
    -copy
    -find first empty cell in range d7:d16
    -paste
    -do it until last non empty cell row number is lower than first empty cell row number

    Here's the code I have:
    Please Login or Register  to view this content.
    Buttons: "Pokaż K/B" runs macro and "Wyczyść" cleans data

    Please give me some advice.
    Attached Files Attached Files

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,966

    Re: Trouble with macro (empty and nonempty cells)

    Maybe you could provide an example with some 'before and after' scenarios so that your requirements become a little clearer.
    Martin

    If my solution has saved you time and/or money, please consider sponsoring my run in the 2020 London Marathon in aid of Cancer Research UK.

    https://uk.virginmoneygiving.com/MartinRice

  3. #3
    Registered User
    Join Date
    10-07-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Trouble with macro (empty and nonempty cells)

    Current solution (which I'd like to be improved):
    B7, B8, B10 = Tak
    D7 = oku
    D8 empty
    D9 = cholesterol
    D10 = oku

    After (only unique values and no empty cells between cells with data):
    D7 = oku
    D8 = cholesterol

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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