VBA Copy Range of cells with a condition to another worksheet

  • Thread starter Thread starter SDS_Feole
  • Start date Start date
S

SDS_Feole

Hello,

I'm a beginner to Excel VBA so any suggestions would be very help.

Here's the scope. I have a worksheet that consists of 3 columns of data. 1
column has a formula (with a value) and the other 2 columns have values only.
In the rows, not all cells have data so I wish to omit those rows from the
copy process. I would like to copy the values from worksheet1 to worksheet 2
where all 3 rows have values omitting the rows that have null values.

Example:

Dept Account Amount
=====================
0000 10001 500
0000 30002 650
0000 30106 1139
40504
3454 51125
4050 46925 5000

In the example above, I would like to copy (from worksheet1 to worksheet2)
the first 3 lines and the last line that have values for Dept Account, and
Amount excluding line 4 and 5.

I hope I explained this clearly.

Thanks again for any suggestions
Tony
 
One way to do this is to add the automatic filter on, then select criteria
for each column to exclude blanks. Then copy/paste the remaining cells into
another worksheet. Look at Excel Help for more on this.
 
My response was a manual one, but if you really want VBA, you can record a
macro while performing the actions, then review the VBA code it generates.
There is usually a lot of extra code in the recorded macros, but it is a good
start if you need to repeat the actions often.
 
Back
Top