Basically what I want to achieve is assigning the cell value from the other workbook into my code.
- Customers send in a spreadsheet of goods they want to order and this spreadsheet is used for more than one purpose so it has many columns which are not needed for my purpose.
- So I created the macro to look up and give me the value from certain columns and spit out a CSV file.
- I then created a spreadsheet of my own with the column values all mapped out, I am trying to get the coding to lookup the cell value in my spreadsheet and knows which columns to be looking up on the customer spreadsheet.
- I want it so I can just go in and change the values in the cells on my spreadsheet instead of having to go into the coding and change the columns value in my code.
ShipToSiteID = Application.WorksheetFunction.Trim(Range("Q" & counter)) AltShipTo1 = Application.WorksheetFunction.Trim(Range("G" & counter)) AltShipTo2 = Application.WorksheetFunction.Trim(Range("H" & counter)) AltShipToCity = Application.WorksheetFunction.Trim(Range("I" & counter)) 'AltShipToState = Application.WorksheetFunction.Trim(Range("I" & counter)) AltShipToZip = Application.WorksheetFunction.Trim(Range("J" & counter)) AltShipToCountry = "UNITED KINGDOM" RefNumber = counter - 1 UserId = LCase(Environ("username")) ShipToSiteID = Replace(ShipToSiteID + AltShipToZip, " ", "") Sheets(2).Select Range("A" & counter - 1) = LineType & comma & RefNumber & comma & QName & comma & BlanketID _ & comma & BillToSiteID & comma & ShipToSiteID & comma & ContractID _ & comma & PONumber & comma & CaseID & comma & ShipVia & comma & RequiredDate _ & comma & Comments & comma & Priority & comma & TerminalID & comma _ & AltContactFirst & comma & AltContactLast & comma & AltPhone & comma _ & AltShipTo1 & comma & AltShipTo2 & comma & AltShipToCity & comma _ & AltShipToState & comma & AltShipToZip & comma & AltShipToCountry _ & comma & UserId & comma