VBA Copy Range of cells with a condition to another worksheet

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
 
D

Daryl S

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.
 
S

SDS_Feole

Thanks for the reply. Is your suggestion using VBA? I know how to do this
manually.
 
D

Daryl S

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top