PDA

View Full Version : Help with VBA



justinfox
06-21-2018, 05:27 AM
Hey guys I have this excel file I want to change one thing on and I cant figure it out. On the sheet called "Input" I want to be able to select a scale number in the upper right hand corner and have it copy over all of the information from the sheet called "Database." Right now when I select the scale number it only copies up until the "Bin/Lot ID" and leaves out the "Destination" and "Comments" columns.

Please help!

NoSparks
06-21-2018, 06:08 AM
Your lCellsDE variable is equal to a cell count of the named range "OrderEntry" which is 14.
You are then using that 14 as the last column to copy instead of the number of columns to copy.

Try changing this line


.Range(.Cells(lRecRow, lColHist), .Cells(lRecRow, lCellsDE)).Copy

to


.Cells(lRecRow, lColHist).Resize(, lCellsDE).Copy

justinfox
06-21-2018, 06:20 AM
AMAZING!!! THANK YOU SO MUCH!! That was such a headache!!!

Love this site!