Open excel, open a new macro (tools > macros - depends on the excel version), paste the code there and save it as a new macro, then when you select a range from the excel table itself and run the macro, it will generate a PDMS macro that you can run in the command window in PDMS Draft.