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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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>
 
Upvote 0
I'll give it a try.. If not i seem to be able to make minor adjustments for what i'm trying..


thanks
 
Upvote 0

Forum statistics

Threads
1,214,954
Messages
6,122,461
Members
449,085
Latest member
ExcelError

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
Back
Top