Hi all! I have been trying to make vba code for the following purpose: copy a range of a workbook (screenshot above A1:F2) to a new workbook. I have managed to achieve this. There is one additional criteria which i would like to add to the vba code. The vba code should only copy those columns where row 2 has a value filled in. Thus, looking at the example in the screenshot, this would mean that by running the vba code, I would save to a new workbook the ranges A1:A2, C1:C2, E1:E2. The new worbook would look like the second screenshot
Any help appreciated! Thanks in advance!
A very useful way of ignoring blanks - without looping - is to use
SpecialCells
. The code below is probably a little lengthier than needed for your question but it is written so thatcode