+ Reply to Thread
Results 1 to 18 of 18

VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

  1. #1
    Registered User
    Join Date
    09-15-2014
    Location
    NC
    MS-Off Ver
    Office 2010
    Posts
    9

    VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    New to VBA, figures I would attempt to do something way over my head. -- I've purchased books, searched the internet, and finally will turn to complete strangers for help and guidance.

    What I am trying to do:
    Copy/Transfer information from a column only with values from one sheet (in the file attached the "Schedule" or "DO NOT USE" sheets), to another sheet, in a specific area (in the file, each shift is put on it's appropriate day sheet). (Lots of destination code necessary?)
    I then need the name to populate in relation to first column, from the row where the data/value was found. (For example, if the Monday shift was found in cell D3, then I need the name from B3 to populate in the appropriate cell on the corresponding "Monday" worksheet.)

    Not so great with VBA jargon, so forgive me if I come off as VBA illiterate.

    I had planned this out with nested if functions in my head. About the time I started putting it together, I realized that wasn't going to work as well as I had envisioned.

    (I sincerely hope you, the reader understand what I'm looking to do.)
    Is this even possible?
    I'm sure it is, but have no code to prove it.
    If someone could even just carve out a skeleton for me, I'm sure that I could figure it out and beef it up.
    I'm at wits end here, have been pouring over this for a week non-stopped.

    Any help is greatly appreciated!

    Copy for Internet Help.xls

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Hello kbarnes04,

    Welcome to the Forum!

    It always nice to have another Tarheel join us. Your layout is consistent on the sheets for each day of the week. That makes life a lot easier when doing copy and paste operations.

    I will need some time to write and test the code out. How soon do you need this?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    09-15-2014
    Location
    NC
    MS-Off Ver
    Office 2010
    Posts
    9

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    There is absolutely no rush.
    In a perfect world, Friday. But, anytime next week would be fine too!
    I would just like to see my dream workbook come to life.
    As a result of this "biting off more than I can chew" my new life mission is to learn everything VBA. Ha.

    Tarheel born, Tarheel bred.
    Looks like you've migrated a bit?

    Also, THANK YOU for attempting to help me!
    You're my hero!

    --Kandy

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Hello Kandy,

    I was born an reared in Asheville. I done left when I was 19 . I couldn't resist the accent.

    That's when I join up with the Navy. After 6 years, I took a job out here in California with the Stanford Linear Accelerator as principal science and electronics tech.

    I got lots of kin back in North Carolina and try to visit at least once a year.

    Can you give me some examples of what data is going where? It isn't clear to me from the workbook.

  5. #5
    Registered User
    Join Date
    09-15-2014
    Location
    NC
    MS-Off Ver
    Office 2010
    Posts
    9

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    You know us N'oth Carolinians ain't in to all that there fancy talk.
    Luckily, I've some how evaded the accent, I move around too much.
    I'm only country on the inside.

    On the "Schedule" tab, any shift can be entered -- Example 11-7 or 11am-7pm or 10-CL --
    I just need whatever shifts are scheduled (whatever value is entered) in the Monday column...(This is where I thought the simple table on "DO NOT USE" tab would come in handy)...To be put into the Shifts column on the "Monday" sheet.
    Likewise, whatever row that shift was found in, have the name populates in the Name column on the "Monday" sheet.

    Then this occurs for each day of the week.
    So essentially, once you've keyed in your schedule for the week, each one of your daily worksheets magically tells you everything you need to know about that day, including who is scheduled and when.

    Does that help or hinder?

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Hello Kandy,

    Being edumacted ain't hurt me none juz makes talk and write a might peculiar.

    Your explanation is crystal clear. Thanks, I can work that.

  7. #7
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Here you go, this should work. You might want to format your shift column on your days of the weeks tabs to Text, the shifts kept showing up as dates (e.g. as shift of 9-6 was showing up as 6-Sep).

    Please Login or Register  to view this content.
    Runs in under a tenth of a second with 16 employees listed.
    Last edited by walruseggman; 09-17-2014 at 04:23 PM. Reason: Additional Info

  8. #8
    Registered User
    Join Date
    09-15-2014
    Location
    NC
    MS-Off Ver
    Office 2010
    Posts
    9

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Very nice!
    It works! *head explodes* Haha.
    I'll just make a button to clear the sheets too...
    If you run it multiple times it repeats shifts.

    Thank you!

  9. #9
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    It "repeats" because it looks for the first available empty row. If you already have shifts in there, yes it will just insert the the shifts under the already filled rows.

    The easiest solution probably would be to clear all the shifts first. Sounds like you know how to do?

  10. #10
    Registered User
    Join Date
    09-15-2014
    Location
    NC
    MS-Off Ver
    Office 2010
    Posts
    9

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    That I can do.
    Impressive, no? Haha.

  11. #11
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Hey, there's no fault at being at any skill level. I'm working to improve, too. (Like whoops, I could have combined those two For loops, and yup this may have been simpler if i had used a Dictionary instead of arrays, but I'm pretty rusty with dictionaries.)

    And oh, I forgot to mention, you can get rid of the DO NOT USE sheet, it isn't utilized in my code.

  12. #12
    Registered User
    Join Date
    09-15-2014
    Location
    NC
    MS-Off Ver
    Office 2010
    Posts
    9

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Lovely!
    I'm going to play around with it some more.
    Try to see if I can figure out all the code you used.
    Seems I've got more research to do.

  13. #13
    Registered User
    Join Date
    09-15-2014
    Location
    NC
    MS-Off Ver
    Office 2010
    Posts
    9

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    I'll preface this with, I'm blonde...How do you mark this as solved?

    I'm still willing to look at any other code offered up though!

  14. #14
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Not sure about marking Solved, I'm kinda new here too.

    And I should have commented my code. I'd be happy to explain anything, or if you want I can just go back and try to add comments to the code.

  15. #15
    Registered User
    Join Date
    09-15-2014
    Location
    NC
    MS-Off Ver
    Office 2010
    Posts
    9

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Totally up to you, but if you have the time, I'd be very grateful for comments.

  16. #16
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Ok, here's some very basic comments. They do more to explain what is happening than how it specifically works, so again, any questions on the syntax of the code, just ask.

    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    09-15-2014
    Location
    NC
    MS-Off Ver
    Office 2010
    Posts
    9

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Thank you for the comments!!
    AMAZING!!

  18. #18
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Code Needed - Move Data/Ignore Blanks/Data is Moved to Specific Area

    Glad to help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Help Needed! a macro to move specific data between sheets
    By queenieheart in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-01-2012, 11:28 AM
  2. VB code help, ignore blanks/specific
    By ad9051 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-08-2011, 04:38 PM
  3. Data Validation - ignore blanks
    By Neville in forum Excel General
    Replies: 10
    Last Post: 11-09-2005, 10:10 AM
  4. [SOLVED] Ignore Blanks in Data Validation
    By Ricky in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  5. [SOLVED] Ignore Blanks in Data Validation
    By Ricky in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM

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