+ Reply to Thread
Results 1 to 16 of 16

Remove Empty Cells........

  1. #1
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Remove Empty Cells........

    I'm trying to transfer data from a sheet i receive weekly to a pre-made sheet. I have seen examples showing how but i just cant seem to figure it out. Ive attached a striped down copy of what i receive. the data I'm trying to capture is F3:K3 as well as F14:K14, leaving out the blanks in between. The problem is the report i receive is 250 rows and the data is always moving up and down the rows, but it does always start at F3:K3. I've been trying to figure this out for a week now. Ive read the thread "http://www.excelforum.com/excel-general/689093-list-has-blanks-in-it-create-new-column-without-the-blanks.html" but it doesn't seem to work for me. Truth be told I'm just learning excel, and any help would be greatly appreciated. Not sure if it makes a difference but I'm using Office 365 Home Premium.
    Attached Files Attached Files
    Last edited by Richard Fitzinya; 03-24-2013 at 11:07 PM.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Remove Empty Cells........

    Don't know how you feel about using a macro to do the job.

    Perhaps this could be of use to you? To sort data run macro called "Move_Data" and see if the result on Sheet2 is what you are looking for.

    Alf
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Re: Remove Empty Cells........

    Thanks Alf. Two problems. One, the first cell isn't always filled. The last one is if that helps. Two is it possible to have the info populate starting at cell C3.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Remove Empty Cells........

    Ok have fixed the range bit but not sure what you mean by
    the first cell isn't always filled.
    You also have merged cells in your spread sheet and the macro is not to happy about that I had to make some funny adjustments I'm not too sure about. Works in your uploaded file but check when you have more data in your sheet.

    In sheet2 I've just copied your headings (merged cells) and macro will not remove them when doing a rerun.

    Alf
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Re: Remove Empty Cells........

    what i mean is cell F3 and G3 are sometimes empty, but H3,I3,and so on do have data always. i noticed the =100 line in the macro, but sometimes it is not 100. sometimes the first 2 cells of the series are blank but the rest always have data. can it be changed to look for non blank cells starting in K3 and continue down, yet still record everything in the range F3:K3, and so on. See new example. I would like it to record the blank cells as well. Again thank you for the help Alf.

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Remove Empty Cells........

    Your merged cells are really upsetting the applecart. I've tried using the other cells but no luck so far.

    Managed to get macro to work checking column E and the value "Total" is ok? If not tell me and I'll have a go at it again.

    It's slowly becoming a mater of pride for me to solve this problem.

    Alf
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,620

    Re: Remove Empty Cells........

    here's another try:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by protonLeah; 03-24-2013 at 06:12 PM.
    Ben Van Johnson

  8. #8
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Re: Remove Empty Cells........

    That will work. "Total" is always there. Thank you, Thank you, Thank you, I would have never figured that out on my own! Where is a good place to learn more about excel macro's? I want to understand why that works.
    Last edited by Richard Fitzinya; 03-24-2013 at 08:51 PM.

  9. #9
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Re: Remove Empty Cells........

    I've noticed 1 problem(my fault). I need the data at Y3,Y14, and so on. Can the macro be set to give me all the data from cells A:Y when it finds "Total"?

  10. #10
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Re: Remove Empty Cells........

    Never mind. After a bit of trial and error i think i under stand the macro. Learning is doing. A smart man once told me that. Thank you so much for everything.

  11. #11
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Remove Empty Cells........

    Thanks for feed back and glad you got it working.

    Alf

  12. #12
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Re: Remove Empty Cells........

    Hey Alf is there a way to add another word to the macro and return both lines, one after the next?

  13. #13
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Remove Empty Cells........

    Yes of course perhaps like this i.e. change line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    I used the Trim command as I found out that the label is not "Total" but "Total " and this makes a difference but the Trim command gets rid of the extra space at the end. You can see the extra space if you select cell E3 or E14 and press the F2 button on the keyboard.

    The Offset command takes two values i.e. row offset and column offset. These values can be negative or positive depending on their position.
    If for example the E column is the one you use for finding the value "Total" and the wish to copy the range from C column to K column the range to copy the size of the range is Range(cell.Offset(0, -2), cell(0, 6)) i.e. same row as your E value Offset(0, and 2 column to the left of the E column gives cell.offset(0, -2) and the second cell has a row offset of 0 and a column offset of 6 i.e. cell.Offset(0, 6)

    So if you wish to copy all the way to the Y column you need to change the last cell offset from cell.Offset(0, 6) to cell.Offset(0, 20)

    Alf

    Ps If you are happy with my answers you could click on the small star (bottom left in my post) and give a rating to my help.

  14. #14
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Re: Remove Empty Cells........

    Question..... What would an exclusion variable look like? Lets say i wanted to skip the lines with "Total " that also have "Christian" in the Employee field. Is something like that possible?

  15. #15
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Remove Empty Cells........

    One you could use assuming the E column is used for the "Total" would be:

    Please Login or Register  to view this content.
    where both the E and the C column is checked and both conditions must be fulfilled (E value "Total" and C value not "Christian") in order to proceed to the copy and past lines.

    Alf

  16. #16
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Re: Remove Empty Cells........

    That's good to know. Thank you again.

  17. #17
    Registered User
    Join Date
    03-22-2013
    Location
    here,there
    MS-Off Ver
    Office H/S 2013
    Posts
    9

    Re: Remove Empty Cells........

    Perfect! Excel Forum ROCKS!....... Thanks Alf.

+ 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