+ Reply to Thread
Results 1 to 124 of 124

Missing macro needed to sync (move 3 ranges) align with col-A

  1. #1
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Missing macro needed to sync (move 3 ranges) align with col-A

    Hi there,

    I hope if someone may be able to help out on constructing a missing macro, essentially for moving/re-aligning some rows (but only the SPECIFIED ranges) not entire row, that can go awry (misaligned) when new entrants joined the class, or some have left, which may occur every time workbook is opened.

    The workbook LBI is opened on each class day (Mon - Fri), at least once, normally 1 - 4 times per day. There are 3 different subjects and each subject is taught by a teacher. The actual sheet has 200 rows but is currently not filled to that yet. Each day, each of the teachers opens the same workbook LBI.xlsx after their class has been conducted, & inputs values in ranges A2:A,F2:H for each kid. The next teacher who resumes class for the next subject on same day does the same, & so on till the 3rd teacher ends for the day.

    The 2 key tasks of the workbook each day are to: I) see macro segment 2a: assign AL:AN to BL:BN to register for previous class day scores, but based on the criteria that dates in each row AG2:AG not blank and not = TODAY() (in AG1), else do next step till loop ends. I have been able to make this macro with the kind help of @davesexcel. II) segment 2b: assign latest F:H scores to the corresponding rows in AL:AN every single time workbook is opened regardless if each AG date equals TODAY (AG1) or not.

    The target ranges with issue are: AF2:AG,AL2:AN,BL2:BN. All other cells are bound by other simpler macros so must not be moved.

    A new class for this fall isto be opened consisting of 9 students, the first day of school, on Oct 30, 2020.


    On the 1st day Oct. 30 trial class, all students register their scores, and there is no previous day scores data, so BL2:BN is blank.

    On the official day of class, Nov. 2, the sheet does its task and first assigns the Friday scores to BL2:BN, and then assigns the latest scores for each subject during the day into AL2:AN. (see img)
    Attachment 701107
    Attachment 701111

    Same day, at the end of the 3rd subject, all scores are assigned. (see img)
    Attachment 701112

    And, similarly for the next class day.


    Basically, this macro seems to be handling well, that is if students stay at 9 kids and if nobody leaves school, and no new entrants join. Now, if new entrants join the class, say 3 new kids Billy, Edgar & Kylie joined class on Nov. 4, total students now makes 12. Then, A2:A,F2:H expands below an additional 3 rows, but the ranges AF2:AG,AL2:AN,BL2:BN remain stuck at 9 rows, with rows most being out of synced with A2:A,F2:H. (see img)
    3a.JPG

    This makes a need to plug in additionally another segment 1 in my macro, before the above 2a,2b segments, so that every time as the workbook opens, it has to first check for any misaligned issue, by checking to see if there is at least 1 pre-existing filled value in AF2:AF becoming NOT equal to A2:A (to make sure not a single is out of sync), & if all are checked to be perfectly aligned then assign A2:A to Af2:AF, and proceed to do segments 2a,2b.
    Else, do not assign to AF2:AF, instead go look for & select only those misaligned rows in the ranges (AF2:AG,AL2:AN,BL2:BN) & sync them (either move values?/move cells?) by matching AF2:AF with A2:A & bringing along with them the corresponding values in AF2:AG,AL2:AN,BL2:BN accordingly. (see img)

    5.jpg

    After much thought, I think this is the way to resolve this out-of-sync situation. Can anyone help? here'smy current macro:

    Please Login or Register  to view this content.


    Stewart
    Last edited by MannStewart; 10-24-2020 at 07:54 AM.

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    We'd liketo help, but we really need to see a sample file, as per the yellow banner above.

  3. #3
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Hi maniacb,

    i attached the simplified file here, my segment 2a macro isn't working at the moment anymore.

    You can enter trial dates in AG2 downwards or any weekday before your today date, then click the button to see what I mean.


    cheers
    Stewart
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Here is an approach that may work. This code will implement rows in columns F:G & J, but you may not want that. That code can be easily altered. The code supports deleting a row & adding a row. Adding more than 2 entries back to back will not work right now, except for adding names to the end of column A.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    hi maniacb


    Appreciate your suggested code.

    I'd like to ask, is there any way that a macro line could act in a similar way as the formula function INDEX MATCH, such that the old values in BL2:BN could search for the shifted ID names, and assign the prior values back to the new locations ?


    If not, i will try to work & build on your code



    cheers
    Stewart
    Last edited by MannStewart; 10-26-2020 at 05:37 AM.

  6. #6
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    The challenge is in adding or removing segment spaces, where the status of the line alignment shifts during the code change. the function INDEX MATCH is based on static data, but in this case the data changes and would not be accurate . Let me know if there anything else i can assist with

  7. #7
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    alright, i understand. i was experimenting with another way around the issue but have to create another workbook, then copy & paste the values there instead of inputing manually by each teacher.

    The lame thing is i think my code below is very slow in popying & pasting over, it drags for a lengthy good 36 secs to complete. I wonder if you can suggest me a faster way to copy & paste just between 2 workbooks. I've searched online but most are too complicated or do not work when i adapt them to my code.
    Here's the really slow macro i made today:

    Please Login or Register  to view this content.


    Stewart
    Last edited by MannStewart; 10-26-2020 at 10:26 AM.

  8. #8
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Give this a try. the end sub was missing above, so I added it below

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    hi maniacb

    thanks for the prompt response, so
    i used your code but on run, Excel pops up this error msg:

    RUN-TIME ERROR-438
    OBJECT DOESN'YSUPPORT THIS PROPERTY OR METHOD


    what is causing that?

  10. #10
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    What line is highlighted with the response?

  11. #11
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    i was also looking hoping to see which line but the VBA editor does not highlight nor position cursor at the offending line, no yellow highlight at all, it just won't execute

    could it be your suggested shortened referring range method is not allowed in my old Excel ..? .. any other reason ?

  12. #12
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    That could be, although there is one line in the code that does not have a workbook reference. Assign a workbook to that line and see if that does the trick

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    i tried your sugg, but it was the same i don't think it was that

    i also tried adding the Sheets name, altho those 2 simple workbooks have only 1 sheet, which didn't really need it i think, but it didn't work either

    i hope you can think of the reason as i have run out of possibilities with my limited VBA knowledge

  14. #14
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    i tried creating a separate button, this time it shows the highlight of the error:

    the 1st highlight is the line:

    Workbooks("register.csv").Range("A2:A" & Range("A2").End(xlDown).Row).Copy

    so, i think every of the rest of this type would be causing the error too, but why?

  15. #15
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Disregard my shortened code. Each sheet must be selected before the range can be used, and my code doesn't do that.

  16. #16
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    so you mean, i have to stick back to my original & 34sec slow run code..? is there no other faster way ?
    Last edited by MannStewart; 10-26-2020 at 12:08 PM. Reason: adding point

  17. #17
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Let's try this

    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    hi maniacb

    tried that too, but unfortunately it's still the same, the same error msg and highlight is on the same line ..


    searching for this error message on the net, i came across some similar situations of copy/paste between wbs examples that came up this error, i noticed most of the solutions involve the 3 common commands like ARRAY,UNION,RESIZE though i can't comprehend them. maybe you can..? do you think these could help the issue?
    Last edited by MannStewart; 10-26-2020 at 09:16 PM.

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    MannStewart

    Here's my interpretation of your problem.
    See if this works as you expected.
    Please Login or Register  to view this content.
    Edit
    Replaced code and attachment due to a bug.
    Attached Files Attached Files
    Last edited by jindon; 10-26-2020 at 10:33 PM. Reason: Fixed a bug.

  20. #20
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    hi Jindon


    thanks for the code, the AL2:AN part is correct working, but the BL2:BN part is wrong. reason is this: if criteria met, then BL2:BN has FIRST PRIORITY to receive the OLD values from AL2:AN BEFORE AL2:AN receives the new values from F2:H. can you tweak it that way? BL2:BN is to store old values (the previous class day scores). i tested your code, but BL2:BN is getting the SAME NEW values as AL2:AN is getting on running

    also, can you help to add 1 more criteria to the date range AG2:AG, that is, if AG2:AG is blank but there is a new student on the row, then assign today date to the cell in AG2:AG


    Stewart
    Last edited by MannStewart; 10-26-2020 at 10:49 PM.

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Confusing...

    AL:AN is populated from F:H under the conditions.
    What is "OLD values"?

    Can you just show me the result that you want in BL:BN?

  22. #22
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    hi Jindon

    you see...

    each time on opening workbook, FIRST AL2:AN needs to assign its values (called OLD values because it was previous data when saved wb) to BL2:BN, if criteria met, THEN after that done, itself AL2:AN receives assign from F2:H if criteria met (called NEW values because they are latest from F2:H). it's just like that. but if BL2:BN criteria to be populated on wb open is not met, then just assign F2:H to AL2:AN.

    (you can visualise like this: upon wb open, the data in AL2:AN needs to migrate to BL2:BN first, BL2:BN holds old data for AL2:AN. then AL2:AN is empty and it gets new data from F2:FH. of course, both migrations need to be subject to criterias met)

    let me know if the above is ok, or i'll resend you some screen shots basically is the same images attached in the post earlier ..
    Last edited by MannStewart; 10-26-2020 at 11:11 PM.

  23. #23
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    That means BL:BN would have some values already, and keep remain when criteria doesn't match?
    In this case it should be blank?

  24. #24
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    if it is a new student, ie. student's 1st day to class is today, then this student's BL2:BN will be blank, because he/she has no yesterday value, but if the student is at least 2 days or more already in this school, its BL2:BN on the row must have values.
    But AL2:AN is necessarily always filled even if today is student 1st day. And, assign TODAY date to AG2:AG of the new student at the end of all assign processes, so that when open wb tomorrow morning, the date will be 1 day less than tomorrow, therefore purpose is to allow tomorrow AL2:AN to send to BL2:BN.

    OLD student: AL2:AN assign to BL2:BN first (yesterday scores), where BL2:BN has (already filled yesterday minus 1 days ago scores) values, overwrite is ok. Then, F2:H assign to AL2:AN new values (today scores), assign TODAY() to AG2:AG
    NEW student: F2:H assign to AL2:AN (existing is blank). Leave BL2:BN blank because AL2:An has no old values to offer. And, assign TODAY date to AG2:AG of the new student at the end of all assign processes, so that when open wb tomorrow morning, the date will be 1 day less than tomorrow, therefore purpose is to allow tomorrow AL2:AN to send to BL2:BN.


    pls let me know if you need more clarif'n
    Last edited by MannStewart; 10-26-2020 at 11:26 PM.

  25. #25
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    hi Jindown

    Here it is, the CORRECT Sequence Images:
    it does explain what i was trying to say

    So, let's say, all students are new, school opens brand new for students on its 1st day = Oct 30
    Attachment 701498

    Attachment 701499

    Attachment 701500

    Just before orange goes to AL2:AN, AL2:AN pre-existing values goes to BL2:BN (green) first, and date on AG2:AG is still previous date so criteria allows the green process to go ahead, after it is assigned, then the date becomes TODAY, so for the entire day no matter how many classes, the values in BL2:BN need not change anymore, it already holds previous day scores. it just waits till tomorrow to repeat this process:
    Attachment 701501


    End should be this
    Attachment 701502
    Attached Images Attached Images
    Last edited by MannStewart; 10-27-2020 at 06:57 AM. Reason: images not displaying to forum viewers

  26. #26
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Your attachments are all invalid.
    Picture doesn't help anyway.

    This is to show you just lined up data in Sheet3, so I need to know how it should be done from here...
    Attached Files Attached Files

  27. #27
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    hi Jindon

    i reposted the images, please just have a look at them, they are in sequence & i believe they do help you to see instantly what i mean.

    meanwhile, i'll look at your attachment now first.

  28. #28
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Those pictures are more confusing.
    What happened to the "Categ" column?

    I just need to see the sheet before and sheet after, showing clear logic to derive the result in a workbook, so that I can test my code.

  29. #29
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Jindon

    the categ exists, i just thought to make the images for sequence explaning my point bec you said earlier this was confusing you.

    give me some moments, i'm down with a flu trying to work today, i''ll remake the images and after i go get some flu med, i'll repost the images again here clearly
    i got to solve this before the class opens soon

    pls wait for my remake the images for you

  30. #30
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    give me some moments, i'm down with a flu trying to work today,
    Me, too, so take your time.

    I'm going to sleep early tonight...

  31. #31
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    hi Jindon

    pls disregard all my previous confusing images.

    i've painstakingly constructed this new Entire storyline sample file, 14 sheets, in time sequence of a sampled 3 class days, which covers all main possibilities of the class operation.
    kindly have a browse slowly, because i'm sure you will no longer say this confusing after you go through the sheets 1-by-1 carefully. Your code is in the button, but i think mainly what is needed now is the BL2:BN part. Anyway, pls go through this new attachment file sheet-by-sheet, i spent a long time in flu making it, it tells the whole picture and main possible circumstances that class will be in
    NOTE: Please don't click to run the macro (if you run the macro in the file, the values that explain the Story will be altered, don't alter any values or you'll miss the entire explanation i was trying to make for you). This file is a Storyline Illustration file, its purpose is just for illustrating the sequence of what the school operation is every day. After you comprehend the story, look forward to see how the macro should be tweaked accurately

    by the way, i opened your fFile: xlsm LBI_sample_test Lined up.xlsm, but i think you strayed further from the right understanding as that is not what the solution is.

    Stewart
    Attached Files Attached Files
    Last edited by MannStewart; 10-28-2020 at 09:08 AM.

  32. #32
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    I just had a quick look at the file,

    So ignore categ?

  33. #33
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    no , categ is there, do not ignore it

    kindly browse carefully starting from Sheets admin1 to Sheets 3b in this sequence, pls observe the values , arrows & text narration


    [Errata: school only closes for the day after teacher-c finishes updating the workbook and saves file]
    Last edited by MannStewart; 10-28-2020 at 08:03 AM.

  34. #34
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    There is no adimn1 Sheets 3b.
    Are you referring to admin3 Sheets 3b?

    Which sheet actually telling the conditions about Col.J? (categ)

  35. #35
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Jindon,
    i was not referring to the code, when i said sheets i meant sheet "admin1"is the first sheet, sheet "3b" is the final sheet in the Storyline.

    Column "J" is very rarely changed, only set at the beginning of a new student enrolment, i'm not fully catching why you are focusing too much on this ..?
    It is used as criteria, which i think you rightly wrote in your initial macro:
    Please Login or Register  to view this content.
    Please download the sample file again, is corrected for Illustration mistakes
    Last edited by MannStewart; 10-28-2020 at 08:13 AM.

  36. #36
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Because the line in you code.
    Please Login or Register  to view this content.
    I'm talking about this.

  37. #37
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    where are you seeing this, maybe it was the draft i was working on trying to tweak your version to cover my criteria. i rechecked your code, i didn't put that into the above file this time

    OK, i know to answer your question on that line, it was my original own attempt for the BROWN step. Every time before BROWN step can occur, i need this 3 criteria to be met, ie. date in AG is <> "", AG <>AG1 and the data in "J" categ is 1 of those specified.
    Last edited by MannStewart; 10-28-2020 at 08:25 AM.

  38. #38
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    My code posted is not useful since I didn't fully understand the logic, so I need to rewrite it again from the scratch

    Once I write the code on the basis of wrong logic, it is hardly modify it easily later since updating or not updating Old value Current value etc.
    So I need to understand the full logic before I start.

    So again where can I find those conditions in your newest workbook?

  39. #39
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    ok, sure.

    The conditions, or rather criteria for assigning are in the Story file, ie. for assigning BL2:BN, the conditions are in each brown box, & for assigning AG2:AG, AL2:AN, the conditions are in each blue box. I will outline them for you here again:

    Do firstly, check conditions for assigning BL2:BN met or not [IMPORTANT: BL2:BN MUST be taken care first]:
    if AND (AG2:AG <> "" , AG2:AG <> AG1, (OR (J2:J = "LOW", "NURSERY", "MID", "ONLINE")) then assign AL2:AN to BL2:BN {overwrite blank or filled}
    [note: the data in AL2:AN at this point is NOT the latest data, ie. not TODAY's data, which is represented by F2:H. AL2:AN at this point contains YESTERDAY's data, and it is these old data that BL2:BN wants]

    then after above, check conditions for assigning AG2:AG met or not:
    if OR (AG2:AG <> "", AG2:AG = "", AG2:AG <> AG1) then assign AG1 to AG2:AG {overwrite blank or filled}

    for AF2:AF, AL2:AN regardless (no condition) everytime at the final part of macro, assign F2:H to AL2:AN, A2:A to AF2:AF {overwrite blank or filled}


    About the column AF , actually, i had created it just for the objective to sync the rows whenever they get out-of-sync. If with your new code, it automatically everytime syncs on macro run, this column has no more purpose and can be omitted
    Last edited by MannStewart; 10-28-2020 at 09:09 AM.

  40. #40
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    This is how I understand so far and not sure about 3)-1-b & 3)-2-a
    Correct me if I'm wrong.
    PHP Code: 
    1Look at AF2:AF, if all blankjust copy A2:A to AF2:AF F2:H to AL2:AN

    2
    ) If AF2:AF are already filled
        2
    )-1 Check the order A2:A vs AF2:AF
            2
    )-1-If correct ordergo to 3)
            
    2)-1-If not adjust the oder of AF2:AF based on the order of A2:A togerther with their corresponding AG2:AGAL2:AN and BL2:BN

    3
    Look at the dates in AG2:AG and J2:J
        3
    )-If AG2:AG<>AG1
            3
    )-1-If J2:J<>HIGHreplace AL:AN with BL:BN in the same row and update AG to current date.
            
    3)-1-If J2:J=HIGH what should be done?**********
        
    3)-If AG2:AG=AG1
            3
    )-2-Do nothing?*********

    4Look at J2:J
        4
    )-If J2:J<>HIGHupdate BL:BN with AL:AN 

  41. #41
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    ignore displaying incorrectly see below
    reply
    Last edited by MannStewart; 10-28-2020 at 10:56 AM. Reason: error

  42. #42
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Quote Originally Posted by MannStewart View Post
    ignore displaying incorrectly see below
    reply
    i don't know how to include strikethrough so i had to screenshot
    Attached Images Attached Images

  43. #43
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    OK, now you can see why I uploaded the workbook showing up to end of 2).

    That is sort all records according to the order of A2:A, this is the first step and of course, it all will be done within memory.(not on the sheet)

    It is late, midnight here, and I will be busy tomorrow, so maybe after tomorrow unless my schedule tomorrow is cancelled.

  44. #44
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    i still haven't grasped what that file meant. but i;ll try to look again

    ok, sure no worries,
    i'll be here looking out for your updated

    hv good rest

  45. #45
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    I'm going out soon.
    I need you to test the code.
    Please Login or Register  to view this content.

  46. #46
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Jindon

    just applied the code, i think 3) isn't working, it seems to be the same result as your first code

  47. #47
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    OK, I'll look at it as soon as I come back.

  48. #48
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    How about

    Please Login or Register  to view this content.

  49. #49
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    nope... it's gotten worse this one The data supposed to go to AL2:AN has disappeared and gone straight to BL2:BN

    wrong.PNG

  50. #50
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Still not sure about when categ is not match...
    Getting better?
    Please Login or Register  to view this content.

  51. #51
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    now we are back to square one, ie. 3) isn't working. you see, even if date AG2:AG <>AG1, but the previous data of AL2:AN did not copy to BL2:BN... blank there

    wrong.PNG

  52. #52
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Tried with sheet 2ai and result is the same as 2aii sheet.

    Can you just upload a workbook that you are working with and show me before/after?

    I wonder the date is not picking up correctly at your end.

  53. #53
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    alright, i'll try to upload test files before - after, hang on. but, i'm thinking the key may be due to your specifying DATE as today in your code, how about rephrasing it to if DATE <> AG1, instead of <> TODAY, i mean use AG1 as the condition date, bec i can't make all the full sequence sample files before after if your code keeps setting the AG2:AN to TODAY, can you set it to = AG1 so i can manually modify the AG1 date to make several different sequence files.. hope you getting what i'm trying to infer

  54. #54
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Replace "test" with
    Please Login or Register  to view this content.

  55. #55
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    attached 3 files, in seq start from 0,1 to 2

    AG2:AG
    your code is setting the cells to assign AG2:AG to TODAY, but i think it would be better to set them assigned to AG1. you can see in file 2, even if i manually made 30-Oct just to illustrate you another day, AG2:AG wouldn't change
    Attached Files Attached Files

  56. #56
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    did that, but 3) still isn't working ...

  57. #57
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    What I only want to see is before/after, means before the data and the result that you want after the macro.
    So that it will be clearer hopefully...

  58. #58
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    yes, that was Exactly what i gave you in the really complete sample file yesterday in that Storyline file (LBI_sample_expl.xlsx) , telling from Before which is sheet "admin1", then on, to after, and after, and after till the end sheet "3b" ... in time sequence. Ajnyway, i will make again with the LBI_test files for you hang on

    i think the before after sequence is kinda vague for you here, i wish you can see it clear. hang on, i'm goijng to try to make the files, hope i can make it simpler
    Last edited by MannStewart; 10-29-2020 at 07:42 AM.

  59. #59
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    OK then let's concentrate the data in that workbook.

    Tested all the sequences and working, except the row(s) that aren't match the criteria in Categ.

  60. #60
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Jindon

    pls take another look at this most simplified before-after file, telling the main job of the macro for 1 teacher on running the macro. the macro's job is to make both before & after happen

    i hope this would have cleared out the vaguesness if any you still have ..

    both sheets shows macro already RUNNING what needs to happen WHEN the macro already RUNNING
    Attached Files Attached Files
    Last edited by MannStewart; 10-29-2020 at 08:10 AM.

  61. #61
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Result is exactly the same as after sheet here except the date in row that doesn't match the criteria. AG4 & AG7

    Anything wrong there?

  62. #62
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    no, it's not the same, how can it be you saw same..?

    see again:

    "Before": today is 29, when macro started, the 1,1,1, 1,1,1... all need to be transfered to BL2:BN, so that BL2:Bn get 1,1,1, 1,1,1...
    "After": during the same today 29, after "Before" is done, the 2,2,2, 2,2,2... assign to AL2:AN
    after all done, assign AG1 to the condition-met AG2:AG. end of macro jobs done

    it's just that simple

    i don't know which part you still vague about, i'll try to explain again if you let me know what is confusing you ..

  63. #63
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    your code is handling the criteria for categ correctly, no problem there, your code just NOT handling part 3) that is it is NOT transferring anything to BL2:BN

    for example, as simplified shown in my "before" sheet, that scenario is not happening at all with your code..

  64. #64
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    See the attached.
    result sheet is the result from the code.
    Attached Files Attached Files

  65. #65
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    i see it, that's what i need, but which code made this happen..?

    how come i couldn't get this with any of all your provided codes

    can you list out again the full code that you achieved this result ?
    Last edited by MannStewart; 10-29-2020 at 08:30 AM.

  66. #66
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    The one in the attached, so need to find out the reason why it doesn't work there.

    Reason is, the most probably, the DATE recognition as I mentioned earlier.
    Add one line in bold
    Please Login or Register  to view this content.
    When you run then code, it pauses in that line and get into debug mode.
    After that, as you hit F8 key, the code executes one line.
    when it reaches
    Please Login or Register  to view this content.
    Hover over the cursor to the variable and read the value for each a(i,2) & CLng(myDate)
    Last edited by jindon; 10-29-2020 at 08:39 AM.

  67. #67
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    i'm lost , so the code needs to be adjusted for the unwanted pause? the code in your attached file showing the correct result, was that adjusted?
    should i apply that code, or which code should i apply now , or wait for your updated ..?

    sorry, i coudn't understand at all what you meant by..
    "Hover over the cursor to the variable and read the value for each a(i,2) & CLng(myDate) "
    Last edited by MannStewart; 10-29-2020 at 08:44 AM.

  68. #68
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    The code is the one in my last attached workbook.
    Basically the one in Post #50, and replaced Sheet1 to ActiveSheet.

    You are the only one to find the line(s) that is not working properly, so do a step debug for yourself as I said.

  69. #69
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Jindon

    in debug:

    b(i, 2) = 29-Oct-2020
    CLng(Date) = 44133

    on first loop of F8
    Last edited by MannStewart; 10-29-2020 at 09:05 AM.

  70. #70
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Go down the row a bit and you will reach to the line
    Please Login or Register  to view this content.
    I need to know these values.

  71. #71
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    i = 1
    b(i, 2) = 29/Oct/2020
    CLng(Date) = 44133

    on hovering abv the line
    If b(i, 2) <> CLng(myDate) Then

  72. #72
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    OK that's the reason...
    Try chagne that line to
    Please Login or Register  to view this content.
    And see how it goes.

  73. #73
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    replaced the entire line:
    If b(i, 2) <> CLng(myDate) Then
    with:
    If CLng(CDate(b(i, 2))) <> CLng(myDate) Then


    on run, it's back to square one, ie. 3) isn't happening .. it's total blank there in BL2:BN


    should i insert STOP again to debug ..?

  74. #74
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Can you just run this code?
    I changed the type for myDate to Long.
    Please Login or Register  to view this content.

  75. #75
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    did that
    the only difference this time is AG2:AG assigned AG1 date, but BL2:BN still blank ..

    .. what am i missing or doing wrong ?
    Last edited by MannStewart; 10-29-2020 at 09:23 AM.

  76. #76
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    That's really weird...
    When you find the values of
    Please Login or Register  to view this content.
    b(i, 2) should be the number like 44133, since
    Please Login or Register  to view this content.
    Just hit F8 to reach that line and go to [View] - [Local Window], now you can see all the variables in Local Window and if you click on + sign of variable a,
    Read the value
    a(1, 1) should be "Alan"
    a(1, 2) should be 44133

    Can you check?

  77. #77
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    .. you mean debug & go to the line:
    If CLng(CDate(b(i, 2))) <> CLng(myDate) Then
    because you said change so the line now is above

    i put STOP again at
    Stop
    For i = 1 To UBound(b, 1)

    or put STOp at
    a = Application.Index(.Value2, Evaluate("row(1:" & .Rows.Count & ")"), _
    Array(1, 33, 6, 7, 8, 38, 39, 40, 64, 65, 66, 10))

    which line i should put STOP?
    Last edited by MannStewart; 10-29-2020 at 09:46 AM.

  78. #78
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    No, the line of 9th line
    Please Login or Register  to view this content.
    So, just 9 hits of F8 from the top.

  79. #79
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    locals_a.PNG


    did that, is this what you asked

  80. #80
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    or, this rather this one is the one you asked

    locals_a.PNG

  81. #81
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Yes that's the one and keep click the + sign until you actually see the inside of the array.

    Should look like
    a(1, 1) "ALAN"
    a(1, 2) 44133
    a(1, 3) and so on...

  82. #82
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    here they are, i could see total of a = 1 to 6 only
    Attached Images Attached Images

  83. #83
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Ok that's what I wanted to see.
    Now run then code and it stops again before Select Case and I want you to read b(i, 2) & myDate
    Please Login or Register  to view this content.

  84. #84
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    this one..?




    locals_b.PNG

    or should i go to 7 lines above at Select case b(i,12)?

    ok hang on

  85. #85
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    OOps, did you realize that the last one locals_a56.PNG‎ is showing
    a(6, 2) = "28/10/2020"

    That means it is not a serial date, just a Text, so it can be calculated.

  86. #86
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    .. erm, meaning ..?

  87. #87
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Means it is not a date, just a string.
    It should be a number like the others.

    So change AG7 to a real date.

  88. #88
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    alright, so i have manually set AG2:AG number format to date, it is now Short date format

    but you gave me the line:
    Please Login or Register  to view this content.
    earlier, not:
    Please Login or Register  to view this content.
    which should it be now.. if it matters ?

  89. #89
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    The second one and I want you to read b(i, 2) & myDate both should be a number....

  90. #90
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    is this what you asked
    Attached Images Attached Images

  91. #91
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Now it shows Empty

    b(6, 1) "EDGAR"
    b(6, 2) Empty

    It should be
    b(6, 2) = 44312
    if AG7 is 18/Oct/2020
    Otherwise all should be OK.

  92. #92
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    what's causing that ?

  93. #93
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Can you just delete that row, row7 and run the code?

  94. #94
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Please Login or Register  to view this content.
    you mean this line? this is row7.. del the above?

  95. #95
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    No, delete the 7th row for "EDGAR" in the worksheet.

  96. #96
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    deleted EDGAR row A7:AN7, clicked and BL2:BN still blank. AL2:AN6 are assigned, AG2:AG6 dates are assigned the value from AG1.

    do u still need to see the Locals Window values..?

  97. #97
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    No, I want to know the result if it works like here.

  98. #98
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    on click, BL2:BN is still blank

  99. #99
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    I need you to read the msg
    Please Login or Register  to view this content.

  100. #100
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    run the new code without EDGAR back in the picture?

  101. #101
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Please delete row7 completely from the sheet.

  102. #102
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    msgbox: 5

  103. #103
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Well now no idea, why BL:BN shows blank at your end.

    All is working here...
    Please Login or Register  to view this content.
    Above is the block, if the name in Col.A appears in co.AF, line up the data in F:G, AL:AN & BL:BN
    If new name, it only copies the data in F:G to AL:AN to the same row.

    And make sure you copied the whole code that I last posted #99, not just "Sub sessionend_Click()" part.

  104. #104
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    yes, i copied your entire post#99 code, top to bottom.

    PHP Code: 
    Above is the block, if the name in Col.A appears in co.AFline up the data in F:GAL:AN BL:BN
    If new nameit only copies the data in F:G to AL:AN to the same row
    your code was & is always working for everything except the part BL2:BN which stubbornly shows nothing no matter in what condition,
    i'm just completely puzzled why you can work but mine cannot.. there must be soemthing here blocking the normal procedure

  105. #105
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Shutdown the pc already so talk to you tomorrow.

  106. #106
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    ok

    call it a day

  107. #107
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Since it is working here, obviously the problem is at your end.
    So I can only suggest you to create a new workbook and test it, or use other pc to test.

  108. #108
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    yea, i'll try that but just can't see any reason why that should be as this pc has no problems. just finished trial class we will be using traditional pen and book to handle our work till i seek out the cause

  109. #109
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Jindon

    I want to analyse the OutPut code, because i think the problem BL2:BN is always blank is due to here:
    so, i have 2 questions i need you to help explain for me, referring to attached image:

    Output.PNG

    ques-1: what is the task (denoted red in att img) of this line, because the code never gets pass this line to the lines below (i realised it never gets past this line via F8 debug)

    ques-2: what do the numbers 9,10,11 (denoted yellow in the attached img) denote, are they column numbers? in my debug, i understand that this is for the BL2:BN, and it never executes the task. Also, i would think perhaps this section should run first in OutPut, like this, because it has to get the AL2:AN values before AL2:AN got assigned, i mean rearranged like this, don't you think:
    Please Login or Register  to view this content.

    I suspect the issue is, the relevant part for 9,10,11 is missing? i mean, maybe it should be iii? you defined iii as Long, but i can't find or see any algebra for part of iii
    please comment


    Stewart
    Last edited by MannStewart; 10-30-2020 at 10:56 AM.

  110. #110
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    OMG! what a waste of time.

    I said
    And make sure you copied the whole code that I last posted #99, not just "Sub sessionend_Click()" part.
    And you said
    yes, i copied your entire post#99 code, top to bottom.
    I've never posted such code that you asked.

  111. #111
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    no i copied the whole code of course. i just showed this bottom part because i think the problem at my side it cannot work lies here at the bottom part, so i am trying to understand by asking the 2 questions

  112. #112
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Then what's the relation with the code in #99 with the code that you posted?

    The code you posted is strange.

    Upload a workbook with the code that you are using.

  113. #113
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    i copied the entire #99 code, this part you call strange is part of your #99 code, i dont understand why you cannot recognise it?

    anyway, here's the file i last tried with your code
    Attached Files Attached Files

  114. #114
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    OK, when you run the code on that workbook, AF:AF & AL:AN are exactly the same as A:A & F:H respectively.

    Correct?

    And what is the situation it doesn't work for you.

  115. #115
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    BL2:BN does not receive the vales from AL2:AN.

    anyway, if it is frustrating for you please drop this i'll try to use less efficient ways or something

  116. #116
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Ahh OK, that's what you are keep saying...
    It was my misinterpret of the logic between 1) & 3)
    I thought 1) is totally independent, so, but it also need to go to 3....

    Try this one then.
    Please Login or Register  to view this content.

  117. #117
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Jindon

    BL2:BN finally works! Great relief ...

    .. but i discovered 1 problem now is with AL2:AN, ie. even when AG2:AG date = AG1, & the categ criteria is satisfied, the value in F2:H for that row does NOt send to AL2:AN

    can you see which part of your code needs a tweak there..?
    I think it is just add the condition: if students meet categ criteria, even though AG2:AG is not AG1, but ok to go ahead send values to AL2:AN (only for AL2:AN, do not touch BL2:BN that's perfect now as it is)

    eg. att file, pls focus on FIFI and OPRAH, they are both "MID" and "NURSERY" students, meet criteria. Their AL:AN should change to 6,6,6 & 11,11,11 respectively. Now if you click button, this doesnt happen for these students.
    Attached Files Attached Files
    Last edited by MannStewart; 10-31-2020 at 06:45 AM.

  118. #118
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    That's the part

    PHP Code: 
        3)-If AG2:AG=AG1
            3
    )-2-Do nothing?********* 

  119. #119
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    If you want it to pull from F:H then
    change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  120. #120
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    ..so sorry, that must have been my mistake, was drowning in hapless thinking back then, i was thinking too much about BL:BN that i didnt realise you were asking about AL:AN

    CORRECTED:
    3)-2 If AG2:AG=AG1
    3)-2-a go ahead do AL:AN from F:H, (just Do nothing for BL:BN. pls do not modify anything about BL:BN, unless i discover any issues about this range, i think it should be perfect now)

    So, it's only AL:AN now that needs to tweak

  121. #121
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    See my previous post.

  122. #122
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Thumbs up Re: Missing macro needed to sync (move 3 ranges) align with col-A

    Indeed, you are the Guru.

  123. #123
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    No other things to fix?

    Anyway test it hard and if you find something wrong, because I still not clear about the rows that doesn't match the criteria, post back with a workbook showing before/after.

  124. #124
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Missing macro needed to sync (move 3 ranges) align with col-A

    ok , sure i will, i've generally run trough tested it for a good 15 mins, mainly all the common possible circumstances we might face in daily running, but apart from the one you just fixed for me, seems nothing else i could find atm.

    i'm going to test use it in our class starting Monday.

+ 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. [SOLVED] Move Pivot Table to align with last row of other column
    By Lochlan97 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-28-2020, 04:19 AM
  2. Replies: 4
    Last Post: 10-07-2016, 01:40 PM
  3. Macro help needed to move rows of data
    By erica88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2015, 05:55 PM
  4. [SOLVED] Macro to move cell ranges to next available row .
    By baggypants in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2015, 04:55 PM
  5. 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
  6. move and align cells
    By crillux in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-21-2009, 02:16 PM
  7. Macro needed to move sheets to folders
    By natedog1024 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2007, 04:29 PM

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