How to copie and paste only non blank cells

Viewed 30

I got this case, i need to copy the Col A to Col B, but I need to paste only the value that have a value in the Col B, like in the pictures

enter image description here

Is there any way in excel or vba that do this? Thanks

1 Answers

You can do this in VBA, but it's probably much simpler to do in the Excel UI with a formula and the fill handle. For example, if Column C is your "New B" column, then you could try using the following formula in Column C to do what you're looking to do: =IF(NOT(ISBLANK(B1)),C1=A1). Then just use the fill handle to drag the formula down as needed.

Note that this formula will do nothing if the conditional evaluates to false, i.e., if the cell is blank.

You can see more in the documentation here.

Related