Data completed then copy and paste

Cruizer67

New Member
Joined
Jan 17, 2005
Messages
31
I've got it to copy and paste as well as I can.. but I would like for it to see if all the cells in a range are full before copying.. how would that be done.. I can select a range.. checking if they have data would i use a true or false statement?
thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
May be a little roundabout, but this seems to work for me:

<font face=Tahoma><SPAN style="color:#00007F">Sub</SPAN> test()
<SPAN style="color:#00007F">Dim</SPAN> dataRange <SPAN style="color:#00007F">As</SPAN> Range, dataCount <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>, cellsCount <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>

<SPAN style="color:#007F00">'This is the range to check</SPAN>
<SPAN style="color:#00007F">Set</SPAN> dataRange = Selection

<SPAN style="color:#007F00">'This counts the number of cells in the range</SPAN>
cellsCount = dataRange.Cells.Count

<SPAN style="color:#007F00">'This counts the number of cells in the range that are not empty</SPAN>
dataCount = WorksheetFunction.CountA(dataRange)

<SPAN style="color:#00007F">If</SPAN> cellsCount = dataCount <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#007F00">'if the counts match then...</SPAN>
    <SPAN style="color:#007F00">'your code here (true)</SPAN>
<SPAN style="color:#00007F">Else</SPAN>
    <SPAN style="color:#007F00">'your code here (false)</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>

<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 

Cruizer67

New Member
Joined
Jan 17, 2005
Messages
31
I'll give it a try.. If not i seem to be able to make minor adjustments for what i'm trying..


thanks
 

Watch MrExcel Video

Forum statistics

Threads
1,130,119
Messages
5,640,219
Members
417,131
Latest member
Seanr19871

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top