+ Reply to Thread
Results 1 to 60 of 60

Clean & Customize xlsx sheet with a code

  1. #1
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Clean & Customize xlsx sheet with a code

    Hello code experts
    With the help of a macro I recorded, I have been able to get the expected result correctly. The problem is that this will work only with this data only. I am no expert in writing hard core codes. If the ranges are corrected with a few other problems which are commented in the code, I think there would be no problem to clean and customize every different original bank data received in this format. So, Please, I would really appreciate your help in correcting the code with your expertise. Thank you in advance.
    Please note: If you play the code from the visual basic window, the result is displayed in a newly created sheet. If the sheet name can be renamed as the first date and the last date from the date column it would be really cool. In this case, it is 01-03-2022 to 31-03-2022.
    Attached Files Attached Files
    Last edited by RAJESH SHAH; 04-27-2022 at 04:27 PM.

  2. #2
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    This is just a sample data. In some cases there are 3000-5000 rows. So, if the range of the rows in the code is set to unlimited or till the last row, it would really be great.
    Last edited by RAJESH SHAH; 04-23-2022 at 02:50 AM.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Clean & Customize xlsx sheet with a code

    Try

    Please Login or Register  to view this content.
    Attached Files Attached Files
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    John. I am getting an error = variable not defined/ How do I define hdr - variable not defined.? trying variant....
    Last edited by RAJESH SHAH; 05-12-2022 at 04:02 PM. Reason: #Solved

  5. #5
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    John. Except for the narration it is working as expected. Can you please edit the code and remove Branch Name and Voucher Number from the rows whe they are not available. Like If the Branch name is mentioned then the narration should accept the branch name with the heading else do not show the heading at all. I have a similar code where it was done before. I will share it with you so that it will be easier for you to fit that in your code.

  6. #6
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    John Topley, The code I am sharing is of a completely different csv format where the headings are not in one sequence and the values connected to each heading is distributed all over different rows and not under the heading. If you understand the code, you can take out from the code the lines which do not take the Branch Name if branch name is blank and same goes for the cheque number also and help me to solve the present problem faced.

    HTML Code: 










    [/HTML]

  7. #7
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Please note that I am using option explicit in all my codes and I have defined hdr

    Dim hdr As Variant

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Clean & Customize xlsx sheet with a code

    Please Login or Register  to view this content.
    Last edited by JohnTopley; 04-23-2022 at 03:38 PM.

  9. #9
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    It is just perfect. Thanks John Topley for the code and your time.

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Clean & Customize xlsx sheet with a code

    You're very welcome. Thank you for the feedback and rep.

  11. #11
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    John Topley. I failed to notice that you have missed one step. In the H column you have just removed the format of Cr of Balance column and pasted it.
    After sorting the line from larges to smallest, i require to do that only for the first cell i.e., H2, In H3 I needed to apply a formula and drag it down and then check whether the Balance column last amount and Check column last amount are a match.
    This code is my recorded macro.
    HTML Code: 
    This is to check, while pasting the data of the bank I haven't missed any rows. Please help me to edit the code accordingly. As mentioned in the comments of my code, please get the message box if matched - "Matched Successfully" if it is matched. else "Mismatched" if not matched.
    HTML Code: 
    This is the code used in earlier project to get the msgbox. But the range is different in this case.
    HTML Code: 
    This will complete the project hopefully.
    Last edited by RAJESH SHAH; 05-14-2022 at 06:33 AM. Reason: #Solved

  12. #12
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    John Topley, Please check post #11 and help me to complete the code and close the query.

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Clean & Customize xlsx sheet with a code

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

  14. #14
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Looks like you used the first code you shared where the branch name & cheque number was not removed when the cells were blank. Referring your old code post #8, I did some editing and got it somehow right. But I was not able to edit and get the msgbox.

  15. #15
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    I have commented this line as it doesn't do anything.
    HTML Code: 

  16. #16
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    This code has confused me totally. You have still missed this part. cell H3 after the sort function a formula is inserted and dragged down to the last row, to Check the balance.
    HTML Code: 

  17. #17
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    With some editing the query has been solved. Thanks John Topley.

  18. #18
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Clean & Customize xlsx sheet with a code

    Hello guys
    This is a code written and shared by John Topley. It is working in some cases and in some cases it is not. I am not able to figure out the issue for the error. Please help me to correct this error
    The name of the Sheet should be Bank to test the code. I have placed 2 sheets of which one is producing the result correctly and the other is not.
    One more thing, the msg box is showing mismatch even if it is matched which may be due to the format of the cell in column H. If you are able to edit the range of the selected cell to match without the format in the msgbox code it will be just great.
    Thank you in advance experts.
    Error at
    HTML Code: 
    Attached Files Attached Files
    Last edited by RAJESH SHAH; 05-12-2022 at 04:03 PM. Reason: #Solved

  19. #19
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Need to fix error Run time error 9

    It is because you are calling the 53rd instance in array that only contains 51 items. There are only 51 lines of data on the 'Bank' tab so therefore there are 51 parts to the array 'ar'
    If things don't change they stay the same

  20. #20
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Need to fix error Run time error 9

    If you change this line:
    Please Login or Register  to view this content.
    To
    Please Login or Register  to view this content.
    Then you will be able to call 'ar(53, 1)'

  21. #21
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Clean & Customize xlsx sheet with a code

    I started writing answer in other thread but it was closed by one of moderators, so I'm copying my answer here:

    one line above the error-causing line:
    Please Login or Register  to view this content.
    you have filled ar array with values from A1:H51
    obviusly, this array has only 51 rows, so
    Please Login or Register  to view this content.
    returns an error.
    Best Regards,

    Kaper

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Clean & Customize xlsx sheet with a code

    Continuation thread has been moved here - please don't open duplicate threads on the same issue. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  23. #23
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Understood. Thanks

  24. #24
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Got it. Kaper. Can you please tell me how to edit that line so that I can work with the same code with different (unlimited rows) ranges.
    I can't even find this line in the code where it shows the ar array is filled with values from A1:H51.
    Last edited by RAJESH SHAH; 05-06-2022 at 04:17 AM.

  25. #25
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Clean & Customize xlsx sheet with a code

    Post 20 might have a clue...

  26. #26
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Clean & Customize xlsx sheet with a code

    I can't even find this line in the code where it shows the ar array is filled with values from A1:H51.
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  27. #27
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    I already tried that, changing the name of the sheet and also in the code, but I am getting the same error. Please, help me to edit the code in such a way that the code runs in all scenrios with any number of rows in the Bank sheet.

  28. #28
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Ok. So, the code will select the region in the Bank sheet whatever the number of rows. Right?

  29. #29
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Clean & Customize xlsx sheet with a code

    but I am getting the same error
    What error?

  30. #30
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Run time error 9 at Debug.Print ar(53, 1)

  31. #31
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Clean & Customize xlsx sheet with a code

    Quote Originally Posted by RAJESH SHAH View Post
    Ok. So, the code will select the region in the Bank sheet whatever the number of rows. Right?
    Yes...provide there are no blank rows between...
    Run time error 9 at Debug.Print ar(53, 1)
    You've already been told above why that happens...Your Arr has not got that many rows stored...

  32. #32
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    There ain't any blank rows

  33. #33
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Sintek. Sorry, I am not able to understand. Please tell me in simple words like you are explaining it to a beginner. Will the code run only when there are 51 rows and not other wise.? How do I solve this problem then?

  34. #34
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Clean & Customize xlsx sheet with a code

    See attached...
    Please Login or Register  to view this content.
    CurrentRegion returns a Range object that represents a set of contiguous data
    Attached Files Attached Files
    Last edited by sintek; 05-06-2022 at 04:40 AM.

  35. #35
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Clean & Customize xlsx sheet with a code

    Your code is fixed to run on the 'Bank' tab. The bank tab has 51 rows of data. That means there will be 51 items in the array.

    Are you trying to run it on a different sheet?

    Post 20 explains how to run it on the Bank2 tab where there will be no error on that line of code as there are more than 51 rows of data.

  36. #36
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    I run the code with one sheet only Bank. Each time, I just replace the data by deleting the old data and paste new data in the Bank sheet.
    I posted 2 banks for reference only to test and understand why one works and one doesn't.

  37. #37
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    When I run the code, there is just one sheet in the workbook -"Bank". After t run the code a new sheet is created with the name of the dates of the Bank sheet. That new sheet is moved and copied to a different folder. Again I replace the data in the bank sheet and run the code. This way it goes on.
    I hope you are getting it. (Fingers Crossed)

  38. #38
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Clean & Customize xlsx sheet with a code

    Look at post 34 to understand...

  39. #39
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    No idea why each ws in sheets & next ws.. when there is only one sheet in the workbook when the code runs.
    Ok Forget that. I am sharing this workbook with only one sheet and please tell me why it is running into an error and what is the possible solution.
    Attached Files Attached Files

  40. #40
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    The same code is working with a different data. Please check this too.
    Attached Files Attached Files

  41. #41
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Clean & Customize xlsx sheet with a code

    I am sharing this workbook with only one sheet and please tell me why it is running into an error and what is the possible solution.
    You have already been told on multiple occasions above...
    It errors as their is only 51 rows in that worksheet
    Please Login or Register  to view this content.
    proves this...So this line below will error as you are trying to get a value from row 53 which does not exists...
    Please Login or Register  to view this content.

    No idea why each ws in sheets & next ws
    Was trying to show you in layman's terms how the storing of data into an array works...
    Last edited by sintek; 05-06-2022 at 05:16 AM.

  42. #42
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Please tell me how to solve this.

  43. #43
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Clean & Customize xlsx sheet with a code

    Please tell me how to solve this.
    Remove this line...As there is no row 53
    Please Login or Register  to view this content.

  44. #44
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    If i comment that line out, i am getting another error run time error Type mismatch at .Cells(n, 8) = .Cells(i, 8) + .Cells(n, 6) - Cells(n, 5)

  45. #45
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Clean & Customize xlsx sheet with a code

    The same code is working with a different data. Please check this too.
    Once again...It is working because this data has more than 53 rows...
    If i comment that line out, i am getting another error run time error Type mismatch at .Cells(n, 8) = .Cells(i, 8) + .Cells(n, 6) - Cells(n, 5)
    That's because that code is trying to do a calculation on strings

    I will not intervene as I do not like to work on Other Members' Code...
    Last edited by sintek; 05-06-2022 at 05:25 AM.

  46. #46
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    It has only rows including the headings. I am testing the workbook which is not working. The workbook with 481 rows is working fine.

  47. #47
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    The code is creating the new sheet but it is not working after this line
    .Cells(n, 8) = .Cells(i, 8) + .Cells(n, 6) - Cells(n, 5)
    AS the code stops at the above line it is not playing after that line as removing the format Dr / Cr in column H, auto fit, etc.,
    Attached Images Attached Images

  48. #48
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Clean & Customize xlsx sheet with a code

    I have cleaned up the code somewhat in the below, see if it gets you any closer.
    Please Login or Register  to view this content.

  49. #49
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    That is very nice of you. Let me check it out. Will revert back.

  50. #50
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    It is not working man. I am getting an error run time error 13 type mismatch.. at arr(n, 7) = CDbl(Split(ar(i, 8), Chr(10))(0))

  51. #51
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Clean & Customize xlsx sheet with a code

    It is because on one set of data the numbers end with 'vbnewline & #Dr' and on the other set you have the numbers ending with 'space Cr.'

    Try the below:
    Please Login or Register  to view this content.

  52. #52
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    This code is running in both the workbooks. I will try it in the original data base now. Hope I don't face any problems.
    Last edited by RAJESH SHAH; 05-06-2022 at 07:25 AM.

  53. #53
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    You have missed these lines in the code. They are the very lines which will confirm that whether the data is fully extracted and matched successfully.
    HTML Code: 

  54. #54
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,359

    Re: Clean & Customize xlsx sheet with a code

    Add them back in then - I am helping you to get your code right.

    I left that bit out as the way i see it this:
    Please Login or Register  to view this content.
    Is doing the same as:
    Please Login or Register  to view this content.
    The difference being that one creates the sum and writes the result into the cell and the other overwrites the same cell with a formula that is doing the same thing.

  55. #55
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Yup. I am trying and comparing the 2 codes and editing the code. Hopefully, I will succeed.

  56. #56
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Bro, The code ran without any error. Still, I am not getting the expected result. If you are still online and available I need your help to edit the code in a few places to get the perfect result. Even I didn’t notice till today one small step I left to mention and that is one of the reason I am not getting a perfect match in different data. I will make a list and post it here. You can please check and try it whenever you are free and available.

  57. #57
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Changes required.
    1. Column G is missing to take the 2 decimals and hence it is showing a mismatch.
    2. Column G may contain Cr or Dr in different scenarios. The code shows Cr only. I would like to include Dr also in that line.
    3. As there are 2 different balances Dr. & Cr, the formula to be made optional. If the column G contains Cr. Then the formula in column H should be =H2+F3-E3 and if the column G contains Cr, then the formula in column H should be =H2-F3+E3. Please note that it is possible that a single data may contain both Dr and Cr. So if the code checks each row for Dr and Cr it can apply the formula accordingly in each row.
    4. If possible, Column G to be copied as it is without removing Dr. Cr which was possible in John Topley’s code.
    After that, I hope that will solve all the problems

  58. #58
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    Phew!! Finally solved with the required changes with the help of JohnnyL. Thanks to Cheese Sandwich and Sintek also for there support.
    Last edited by RAJESH SHAH; 05-27-2022 at 04:55 AM. Reason: #Solved

  59. #59
    Forum Contributor
    Join Date
    11-25-2021
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    2,147

    Re: Clean & Customize xlsx sheet with a code

    I am not able to mark this post solved. Will the admin please tell me how to or mark the post as solved.
    Last edited by RAJESH SHAH; 05-27-2022 at 04:58 AM. Reason: #Solved

  60. #60
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Clean & Customize xlsx sheet with a code

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. Copy cell range to another sheet if Cell = 1, Help me clean up my code
    By KFH in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-27-2021, 07:30 AM
  2. [SOLVED] amend actual vba code in renaming specific sheet tab based on cell xlsx and csv
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-11-2019, 08:34 AM
  3. Help with code to convert xls to xlsx and continue with xlsx file
    By 3345james in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2016, 11:47 AM
  4. Merge Data from different .xlsx files & different sheet to a new .xlsx
    By QcSylvanio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-03-2012, 01:11 PM
  5. Replies: 6
    Last Post: 08-28-2012, 03:51 AM
  6. [SOLVED] VBA Code to optimize and clean data- clean out numerical/ or symbol
    By tracylsr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2012, 04:21 PM
  7. Clean Function to Clean Entire Sheet
    By gema in forum Excel General
    Replies: 7
    Last Post: 11-05-2009, 10:07 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