Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default How to copy Validation?

Hello -

I need to copy the validation from one cell to the other. Recording a
macro gives me the following code:
Range("A1").Select
Selection.Copy
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

What I was wondering if there is a way to do this without having to go
through the whole .Select. I do this a few times when a button is
pushed and I don't want to confuse the user by having a moving
selection. I also tried to do a
Range("A2").Validation = Range("A1").Validation
but that wouldn't work.

Any idea? Thanks!
Joe

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default How to copy Validation?

Joe,

Sorry if this is a late entry, but my OE shows this as not having been
answered:

Range("A1").Copy
Range("A2").PasteSpecial Paste:=xlPasteValidation
Application.CutCopyMode = False

HTH,
Bernie
MS Excel MVP


"Joe HM" wrote in message
oups.com...
Hello -

I need to copy the validation from one cell to the other. Recording a
macro gives me the following code:
Range("A1").Select
Selection.Copy
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

What I was wondering if there is a way to do this without having to go
through the whole .Select. I do this a few times when a button is
pushed and I don't want to confuse the user by having a moving
selection. I also tried to do a
Range("A2").Validation = Range("A1").Validation
but that wouldn't work.

Any idea? Thanks!
Joe



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default How to copy Validation?

Bernie -

Thanks so much for your reply ... it was not late and very helpful.
Gush ... I could have thought of that myself!

Thanks again,
Joe

  #4   Report Post  
Posted to microsoft.public.excel.programming
hr hr is offline
external usenet poster
 
Posts: 3
Default How to copy Validation?

I tried copying a cell with validation in xl2000 to a new cell and it works
fine. Yet when I write a macro doing the same thing I get an error. If I
repeat the process using Excel2002 no problems. This is driving me crazy.
Any suggestions?
--
Thanks,
HR


"Joe HM" wrote:

Bernie -

Thanks so much for your reply ... it was not late and very helpful.
Gush ... I could have thought of that myself!

Thanks again,
Joe


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default How to copy Validation?

In the code, change:

Paste:=xlDataValidation

to:

Paste:=6

HR wrote:
I tried copying a cell with validation in xl2000 to a new cell and it works
fine. Yet when I write a macro doing the same thing I get an error. If I
repeat the process using Excel2002 no problems. This is driving me crazy.
Any suggestions?



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



  #6   Report Post  
Posted to microsoft.public.excel.programming
hr hr is offline
external usenet poster
 
Posts: 3
Default How to copy Validation?

I made the changes to the program and it worked like a champ. I am rolling
out a spreadsheet to 100 salespeople that use EXCEL 2000 and now the
spreadsheet works. I had previously rolled out the spreadsheet and had major
problems since I had written the macro to work on Excel 2002 (where is
works). Thanks again your a life savor.
--
Thanks,
HR


"Debra Dalgleish" wrote:

In the code, change:

Paste:=xlDataValidation

to:

Paste:=6

HR wrote:
I tried copying a cell with validation in xl2000 to a new cell and it works
fine. Yet when I write a macro doing the same thing I get an error. If I
repeat the process using Excel2002 no problems. This is driving me crazy.
Any suggestions?



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Validation - copy paste ! Christoffer Bloch Andersen Excel Worksheet Functions 1 March 18th 09 01:22 PM
copy dependant validation cell martb Excel Discussion (Misc queries) 1 January 25th 06 01:42 PM
Copy workbook- Validation function sjs Excel Worksheet Functions 3 December 28th 05 03:00 PM
Excel2000: How to copy data validation using VBA Arvi Laanemets Excel Programming 1 July 13th 04 12:32 PM
Using Validation list to copy from another Workbook stakar[_17_] Excel Programming 2 June 21st 04 02:09 PM


All times are GMT +1. The time now is 11:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"