PDA

View Full Version : [SOLVED] Help with required entry before copy macro works



Erays
09-16-2005, 06:57 AM
If specific cells do not contain data I dont want the user to be able to use the copy macro.

MWE
09-16-2005, 07:46 AM
If specific cells do not contain data I dont want the user to be able to use the copy macro.
the approach here will depend on how many "specific cells" are involved and by "copy macro" you mean something you wrote or a system macro.

If just a few cells and you wrote the copy macro then you might use something like this:


Sub CopyMacro
if Cells(1,4)="" or cells(3.5)="" or cells(8,1)="" then
msgbox "sorry, key cells are still empty; you can not copy",vbcritical + vbokonly
exit sub
end if
end sub


If the target cells nicely group into a range, you could test for empty cells in that range, etc. One method to test is demonstrated in this KB (http://vbaexpress.com/kb/getarticle.php?kb_id=766)

Erays
09-16-2005, 08:27 AM
Thanks works great!!!:hi:

MWE
09-16-2005, 08:30 AM
glad to help. Please set thread to solved.