VBA

Moderators: PavlinII
Number of threads: 1673
Number of posts: 3078

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Getting range to work in my code Posted by nathan2314 on 2 Jul 2008 at 12:25 PM
Hey all,
how come this won't work? I'm trying to create a range and then set another range of cells equal to the created range values.
Here is my code
    If Sheets("Long Term Input Data").Range("AB1") = "E6" Then
        Set training_range_179 = Sheets("179 Training Requirements").Range("C92:Z92")
        Set training_range_365 = Sheets("365 Training Requirements").Range("C92:Z92")
    End If
    training_range_179.name = "training_range_179"
    training_range_365.name = "training_range_365"

Worksheets("179 Training Requirements").range("C4:Z4") = Range("training_range_179")


I thought I had done this same thing in some of my earlier vba coding but it doesn't work. So I must be missing something..
Help!!


Report
Re: Getting range to work in my code Posted by rushentt on 20 Jul 2008 at 1:47 PM
Have you tried using the value property, eg:
Sheets("Long Term Input Data").Range("AB1").Value = "E6"
and see if that works?

Rgds

Terry

: Hey all,
: how come this won't work? I'm trying to create a range and then set
: another range of cells equal to the created range values.
: Here is my code
:
:     If Sheets("Long Term Input Data").Range("AB1") = "E6" Then
:         Set training_range_179 = Sheets("179 Training Requirements").Range("C92:Z92")
:         Set training_range_365 = Sheets("365 Training Requirements").Range("C92:Z92")
:     End If
:     training_range_179.name = "training_range_179"
:     training_range_365.name = "training_range_365"
: 
: Worksheets("179 Training Requirements").range("C4:Z4") = Range("training_range_179")
: 
:
:
: I thought I had done this same thing in some of my earlier vba
: coding but it doesn't work. So I must be missing something..
: Help!!
:
:
:



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.