Data Validation won't copy

C

CLR

Hi All......
XL2k, I record the following macro and it does fine, then when I try to run
it, it stalls on the Pastespecial line.......whut's up please?

Sub Macro2()
Range("E1").Select
Application.CutCopyMode = False
Selection.Copy
Range("E12").Select
Selection.PasteSpecial Paste:=xlDataValidation, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub

Vaya con Dios,
Chuck, CABGx3
 
P

Per Jessen

This work in XL2007, using xlPasteValidation, not xlDataValidation.

Sub Macro2()
Range("E1").Copy
Range("E15").PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub

Regards,
Per
 
E

EricG

I don't know why it recorded "xlDataValidation". It should be
"xlPasteValidation".

If you put "Option Explicit" at the top of your code module, it would tell
you that it doesn't know what "xlDataValidation" is.

HTH,

Eric
 
J

joel

If the cell has validation data you must clear the old validattio
before adding new validation. Something like this

Range("E12").Validation.Delete
 
C

CLR

Thanks EricG, but no joy here........it does the same thing.....crashes on
that line.

Vaya con Dios,
Chuck, CABGx3
:
 
C

CLR

Thanks anyway Per, but still no joy. Your code works fine in xl2007, but I
need it to work in xl2000 and it still crashes there.

Vaya con Dios,
Chuck, CABGx3
 
C

CLR

Thanks joel, but still no joy........still does the same thing, crashing on
the pastespecial line

Vaya con Dios,
Chuck, CABGx3
 
C

CLR

Hi All.......

I'm fortunate enough to have Excel 97, 2000, XP, 2003, and 2007 all on this
computer because this company has about 1000 computers and folks use all the
versions so I want to be sure my code will run in whatever version each user
has.

So, I checked my "Validation" problem on all the versions and it don't work
on 97 and 2000, but works fine as you would expect on XP, 2003, and
2007......so maybe this is just one of those things that can't be done in
XL2000.......maybe I'll just have to hard-code it in each time.


Vaya con Dios,
Chuck, CABGx3
 
C

CLR

Thanks for your interest joel, but I just finished hard-coding the Validation
in, because I need the functon to work in xl2000 and the "Pastespecial" model
don't seem to work there. I thought it would be difficult to find the cells
I wanted to Validate, but in my search for a way to do the "Pastespecial
way", I discovered things that helped with the hard-coding and made it a snap.

I appreciate everyone's help
Vaya con Dios,
Chuck, CABGx3
 

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