• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Any Excel/VBA experts

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Any Excel/VBA experts

    Help, I'm looking to get a macro that will convert a single line on a spreadsheet into multiple lines based on a value on the line:

    Input:
    Item Code Quantity
    A1509 WTFH1 5
    A1645 HFTW3 3
    .
    Output:
    Item Code Quantity Code2
    A1509 WTFH1 1 WTFH1001
    A1509 WTFH1 1 WTFH1002
    A1509 WTFH1 1 WTFH1003
    A1509 WTFH1 1 WTFH1004
    A1509 WTFH1 1 WTFH1005
    A1645 HFTW3 1 HFTW3001
    A1645 HFTW3 1 HFTW3002
    A1645 HFTW3 1 HFTW3003
    Any thoughts on how I can do that with a macro?
    …Maybe we ain’t that young anymore

    #2
    Originally posted by WTFH View Post
    Help, I'm looking to get a macro that will convert a single line on a spreadsheet into multiple lines based on a value on the line:

    Input:
    Item Code Quantity
    A1509 WTFH1 5
    A1645 HFTW3 3
    .
    Output:
    Item Code Quantity Code2
    A1509 WTFH1 1 WTFH1001
    A1509 WTFH1 1 WTFH1002
    A1509 WTFH1 1 WTFH1003
    A1509 WTFH1 1 WTFH1004
    A1509 WTFH1 1 WTFH1005
    A1645 HFTW3 1 HFTW3001
    A1645 HFTW3 1 HFTW3002
    A1645 HFTW3 1 HFTW3003
    Any thoughts on how I can do that with a macro?
    Splitting one row into multiple rows using cell value | MrExcel Message Board give you a starting point?
    merely at clientco for the entertainment

    Comment


      #3
      Appreciate this isn't answering the question you posed, but export it to csv and then use your preferred scripting language, piece of cake. Excel, yuck. Macros, yuck. If someone wants an Excel spreadsheet that contains a macro, yuck.

      Comment


        #4
        Thanks, you're better than google.
        …Maybe we ain’t that young anymore

        Comment


          #5
          Originally posted by jamesbrown View Post
          Appreciate this isn't answering the question you posed, but export it to csv and then use your preferred scripting language, piece of cake. Excel, yuck. Macros, yuck. If someone wants an Excel spreadsheet that contains a macro, yuck.
          Issue is that I'm dealing with a guy who is less technically literate than me. He has data in a spreadsheet, he can copy the data in and out, but even asking him to do a fill down causes problems. I thought that if I could give him a spreadsheet with the macro and just tell him to past his data into one sheet, then hit a button, he'd not mess that up.
          …Maybe we ain’t that young anymore

          Comment


            #6
            Originally posted by WTFH View Post

            Issue is that I'm dealing with a guy who is less technically literate than me. He has data in a spreadsheet, he can copy the data in and out, but even asking him to do a fill down causes problems. I thought that if I could give him a spreadsheet with the macro and just tell him to past his data into one sheet, then hit a button, he'd not mess that up.
            Ah, fair enough. Needs must, I guess. Make sure he enables the macro (edit mode or something) after you share it because it is probably disabled by default for security.

            Comment


              #7
              Originally posted by jamesbrown View Post

              Ah, fair enough. Needs must, I guess. Make sure he enables the macro (edit mode or something) after you share it because it is probably disabled by default for security.
              if not disabled already, it will likely be so in the next office update. Macros are serious security risk.
              I would suggest that if macros are required then get them signed and ask IT admins to allow signed/trusted macros only. And only ones that are signed using the company's CA.
              See You Next Tuesday

              Comment

              Working...
              X