+ Reply to Thread
Results 1 to 2 of 2

Macro to Add value to unknown position

  1. #1
    Registered User
    Join Date
    01-23-2009
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    23

    Macro to Add value to unknown position

    I want to add a value from cell: H12 to an unknown position in file from cell: G12 & move existing cell content down in sheet?

    This is an example of how I want it to work when position is known:
    H12=3.22
    G12=22 (Known Position of Marker)
    So, if G12=22, then H12 (3.22) would be added as the 8th Joint in C22. Existing C22 becomes C23 the 9th joint.
    So basically whatever was in the 8th joint (A22) becomes the 9th joint (A23) & so on and so forth shifts down.

    Click here to see how it looks before code:

    Click here to see how it looks with the code above:

    Click here to see how I want it to look:

    I have this code as a button:

    Please Login or Register  to view this content.
    The way it is: The way I want it:
    BEFORE.............AFTER
    #01 C15 10.21 #01 C15 10.21
    #02 C16 10.75 #02 C16 10.75
    #03 C17 11.26 #03 C17 11.26
    #04 C18 11.15 #04 C18 11.15
    #05 C19 10.66 #05 C19 10.66
    #06 C20 12.33 #06 C20 12.33
    #07 C21 11.58 #07 C21 11.58
    #08 C22 (12.10) #08 C22 3.22 <---Change Starts HERE:
    #09 C23 11.30 #09 C23 (12.10) <---EXAMPLE: 12.10 (12.10) Moves here)
    #10 C24 12.55 #10 C24 11.30

    #11 C27 12.13 #11 C27 12.55
    #12 C28 11.99 #12 C28 12.13
    #13 C29 11.89 #13 C29 11.99
    #14 C30 11.73 #14 C30 11.89
    #15 C31 12.34 #15 C31 11.73
    #16 C32 10.87 #16 C32 12.34
    #17 C33 12.64 #17 C33 10.87
    #18 C34 11.46 #18 C34 12.64
    #19 C35 11.25 #19 C35 11.46
    #20 C36 12.58 #20 C36 11.25
    ..........................AND SO ON...
    The only thing wrong with the code is that C22 gets overwritten.
    Example:
    http://75.158.166.210:8000/tallywithcode4.jpg
    If you look at the yellow all it does is double checks and it says we are missing a length of 12.10 (The joint that got overwritten)

    I hope I've made myself clear on what I'm trying to do.
    Last edited by VBA Noob; 01-23-2009 at 03:25 AM.

  2. #2
    Registered User
    Join Date
    01-23-2009
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    23

    Question

    Please Login or Register  to view this content.
    So if G12=8 and H12=3.22 it should look like this below:

    Example:
    Before: After:
    C21=21 C21=21
    C22=22 C22=3.22
    C23=23 C23=22
    C24=24 C24=23
    C25=25 C25=24
    ...........C26=0 <- This should be 25
    Still a small issue though.
    The last cell is a "0" instead of its value.
    Any ideas???

+ 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