+ Reply to Thread
Results 1 to 9 of 9

switching fields automatically

  1. #1
    Registered User
    Join Date
    09-25-2007
    Location
    Singapore
    Posts
    15
    i have the same question here too.

    What if i want to switch from row d8 to d1 automatically using code?

    i know manually it can be done.

    Any idea how?

    Your reply will be a great help!
    thinkthinkthinkthink
    burst brains with macro vb codes
    http://www.excelforum.com/showthread.php?t=584092

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Hi macroDummy,

    In the future please create a new thread and reference this one.

    As for your query, do you want to switch the values in D8 and D1, or do you just want to move the value in D8 to D1?

    To switch, this code would suffice:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-25-2007
    Location
    Singapore
    Posts
    15
    Hi

    Thank you for your quick response. Ok,next time i will create new thread with the reference.

    Sorry for not being exact.

    What i want is to have values in D8 switch with the values in D1.

    I will try implanting your codes right now.

    Regards,
    Lily

  4. #4
    Registered User
    Join Date
    09-25-2007
    Location
    Singapore
    Posts
    15
    The results give me a blank on row D1.

    Values in D1 to D8 successfully being switched.

    But values in D8 to D1 is blank.

    Regards,
    Lily

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Just for reference, what is the value in D1 and what is the value in D8? And are they text? Stored as text? Numeric?

    I've tried a dozen different values, text strings, etc. and each time I run the code it switches the two cells perfectly.

  6. #6
    Registered User
    Join Date
    09-25-2007
    Location
    Singapore
    Posts
    15
    Hmm.

    I don't know where i get it wrong.

    Values in D1 and D8 are mixed of numbers and text.

    Anyway, for your reference, here is what it looked like.

    switch D8 to D1.zip

    switch D8 to D1[part2].zip

    Thank you pjoaquin.

    Very much appreciated.

    Regards,
    Lily

  7. #7
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Ok, based on your two examples it looks like you're trying to switch rows 1 and 8, not just cells D1 and D8. Right?

    If so, try this code:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-25-2007
    Location
    Singapore
    Posts
    15
    Ok! It was a success!

    Thank you Paul!

    :D

    hmm.

    (Q1) What if i want to loop it. Over and over again. It is possible right?

    Because there will be thousands set of data that will adding up to the MergeSheet.

    And the same header will keep on showing up (e.g. like in row 8)

    (Q2) So how it is possible to make the header be a permanent on row 1?

    I hope you understand what i am trying to say here.

    Best regards,
    Lily

  9. #9
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Yes, it is possible to do both of those things, but you'll probably need to provide an Excel example of your data, not a picture of your Excel data in Word.

    I'm not quite grasping what you're trying to say about the header that keeps showing up in row 8. Does it show up there because you're pasting data, or do you have thousands of lines of data and every 8th row has this heading? Things like that might help sort it out. Looping the code I provided won't really get you much.

+ 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