Results 1 to 10 of 18

Thread: VBA Macro which create new lines by codes

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Apr 2021
    Posts
    6
    Rep Power
    0
    Alan,

    This is just amazing! The macro works almost perfectly. I appreciate your help!
    However, I've faced a problem: in my original list there are some codes that start with 0, for example, '060-062'. I decided to use if-clause and apparently it works, but the current problem lies in 2c part, in particular, in arrOutTempCT() that ignores nulls at the beginning of a code since it is variant and makes them just '60; 61; 62'. I've got no idea how to make it put codes without eradicating 0. I tried to change arrOutTempCT() from variant to string, but certainly it didn't work.
    Attached Files Attached Files
    Last edited by DocAElstein; 05-06-2021 at 08:33 PM. Reason: removed quote cluter

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Quote Originally Posted by Alex Salt View Post
    .... I decided to use if-clause and apparently it works, ......
    ..? ...Can you elaborate on what you mean by that, please




    ( Do you have any feedback for P45cal on his attempt for you )
    Last edited by DocAElstein; 05-06-2021 at 10:56 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

  3. #3
    Junior Member
    Join Date
    Apr 2021
    Posts
    6
    Rep Power
    0
    I mean 'If...Then...Else Statement' so that the macro would add '0' at the beginning of some codes if there was one initially (otherwise it erases '0'), you can see it in the attachment. Anyways, the problem is that the macro ignores '0' at the beginning of some codes (even if I add '0' in if-statement). I wonder if there is any solution, and i think there can be something done with arrOutTempCT().
    Attached Files Attached Files

  4. #4
    Member p45cal's Avatar
    Join Date
    Oct 2013
    Posts
    94
    Rep Power
    13
    Quote Originally Posted by DocAElstein View Post
    ( Do you have any feedback for p45cal on his attempt for you )
    We're getting .xls files but his profile shows Office 2016+ so the Power Queries should work.
    In general, if someone I've tried to help completely ignores that help, I return the compliment when they later want further help.
    That said, the attached includes a tweak to the query which tries to maintain the formatting.
    Attached Files Attached Files

  5. #5
    Junior Member
    Join Date
    Apr 2021
    Posts
    6
    Rep Power
    0
    p45cal,

    I'm sorry for ignoring, I completely forgot to answer you.
    My point is that I need a VBA code (macro) that I could use for other worksheets. I see no macro in your solution. You solved the problem by using table-tools, which is not the thing I need.


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 06-12-2023 at 05:43 PM.

Similar Threads

  1. Replies: 14
    Last Post: 09-07-2016, 01:24 AM
  2. Replies: 9
    Last Post: 08-05-2013, 11:28 PM
  3. Replies: 0
    Last Post: 07-24-2013, 11:20 PM
  4. Replies: 3
    Last Post: 06-01-2013, 11:31 AM
  5. VBA editor auto-deletes spaces at the ends of lines
    By LalitPandey87 in forum Excel Help
    Replies: 0
    Last Post: 06-26-2012, 07:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •