+ Reply to Thread
Results 1 to 15 of 15

[VBA - Help] Offset/Move Value - Details Inside...

  1. #1
    Registered User
    Join Date
    09-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    35

    Question [VBA - Help] Offset/Move Value - Details Inside...

    I am having an issue manipulating a flat file. The macro I have right now does everything I need, except for one thing.

    I sometimes have values in extended columns, rather than below onto the next row. How can I shift/offset these values to the rows below.

    I have 2 grids below, one with an example as it is now and another of what I would like to occur. The values that change will be in RED. The values in RED are sporadic, in terms of which flat file they show up in. I made them red to make it easier to find, they are only red for this example and it is not indicative of any other file set.

    Also, I have attached an example excel document with sample data.


    Thanks!

    Example - Ugly:
    \1

    Example - Good:
    \1

    EDIT: Replaced bottom link, because it was duplicate.
    EDIT: Links to cross posted are below
    http://www.mrexcel.com/forum/excel-q...ove-value.html
    http://www.ozgrid.com/forum/showthread.php?t=199607
    Attached Files Attached Files
    Last edited by timdecker; 04-27-2016 at 03:54 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    You linked the same image twice--Ugly and Good are the same image.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Quote Originally Posted by 6StringJazzer View Post
    You linked the same image twice--Ugly and Good are the same image.
    Thank you for pointing that out, here it is corrected...

    Ugly:
    \1

    Desired Result:
    \1

    Edit: Posted this in reply to above...and I was unable to edit the original post...until now =/
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Afternoon bump...

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Quote Originally Posted by timdecker View Post
    The macro I have right now does everything I need, except for one thing.
    Can you provide the macro?

  6. #6
    Registered User
    Join Date
    09-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Quote Originally Posted by 6StringJazzer View Post
    Can you provide the macro?
    I have also attached 2 sample files (both can be imported at the same time).

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Cross posted at 2 other sites, that I know of.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  8. #8
    Registered User
    Join Date
    09-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Quote Originally Posted by 6StringJazzer View Post
    Can you provide the macro?
    Quote Originally Posted by skywriter View Post
    Cross posted at 2 other sites, that I know of.
    At least 2 others...

    Using the all resources that I can.

    The first one I posted to was to busy. Then I posted here, and it got lost as well. The third one requested I post where I cross posted, and it hasn't gotten buried to deep yet.

    Edit: Original post now contains links to other forum threads.
    Last edited by timdecker; 04-27-2016 at 03:55 PM.

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Thank you for adding the links. For the record, we have a rule that requires links for cross-posting.

    Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

  10. #10
    Registered User
    Join Date
    09-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Thanks.

    By the way.

    I tried using this:
    Please Login or Register  to view this content.
    And while it did move the values from the adjascent columns over to the left and down a row...it also deleted all of the data above its intended destination. How can I modify it so I dont lose that data?
    Last edited by timdecker; 04-28-2016 at 11:40 AM.

  11. #11
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    IsNull is for testing expressions, not so useful for cells. Test for empty string or use IsEmpty instead. I tried that change and it did copy the data to the correct destination, but you only included columns J and K in the code, and didn't delete the source.

    Try this.
    Please Login or Register  to view this content.
    I recommend you use Option Explicit to guarantee that all variables are declared.

  12. #12
    Registered User
    Join Date
    09-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Thanks for this, that worked perfect for the data set at hand!

    But, I forgot to include a data set that had more than 2 values I needed to move. Let's say I needed to move 6 additional (adjacent) values....How would that work? Because now J & K are empty, but the columns to right right are not and also H & I also contain values.

    Thanks again!
    Last edited by timdecker; 04-28-2016 at 11:39 AM.

  13. #13
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    This line
    Please Login or Register  to view this content.
    controls which columns are checked for data that needs to be moved. Right now it's J:M. If you need to extend it to H and I then it needs to be
    Please Login or Register  to view this content.
    If that's not clear, or doesn't work, then show what your data looks like.

    By the way, don't quote the post every time you respond, unless there is something specific you need to point out. It makes the thread really long, and it's usually clear what you're responding to.

  14. #14
    Registered User
    Join Date
    09-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Okay will do, thank you. I had fixed it at about the same time you had posted. There is one more issue after looking at the data before I can finish it...how can I make it so it inserts a new row below before it sets the cells equal to each other?

    Thanks again!

    Please Login or Register  to view this content.
    Last edited by timdecker; 04-28-2016 at 11:46 AM.

  15. #15
    Registered User
    Join Date
    09-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: [VBA - Help] Offset/Move Value - Details Inside...

    Well, thanks for getting me on the right track everyone, especially 6StringJazzer. Here is the final product:

    Please Login or Register  to view this content.
    Last edited by timdecker; 04-28-2016 at 02:52 PM.

+ 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. Need help writing macro to input data in Different row each day: details inside
    By Pimp_mentality in forum Excel Programming / VBA / Macros
    Replies: 51
    Last Post: 10-21-2015, 03:34 PM
  2. [SOLVED] Need to get counts by date for 2 columns (more details inside)
    By excelbrah in forum Excel General
    Replies: 9
    Last Post: 03-01-2015, 08:50 PM
  3. Replies: 12
    Last Post: 11-02-2014, 12:55 PM
  4. Randomly Select Worker Based On Eligibility (see details inside)
    By levitt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-23-2014, 03:11 PM
  5. [SOLVED] Move several contact details currently in one row to several rows
    By tiger234 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-11-2012, 08:30 PM
  6. Replies: 15
    Last Post: 07-15-2012, 02:27 PM
  7. Creating Dynamic Database to Webpage - Details Inside
    By cjm2010 in forum Excel General
    Replies: 0
    Last Post: 02-20-2012, 03:38 PM

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