+ Reply to Thread
Results 1 to 5 of 5

Setting a variable range with a variable sheet name. Hmm?

  1. #1
    Registered User
    Join Date
    02-20-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    92

    Setting a variable range with a variable sheet name. Hmm?

    Hi,

    I struggle with some of the rules required to declare variables in VBA code. I've done things like this in the past, but its not working today and I was hoping someone could easily see the issue. The NewFoundRange I'm trying to declare doesn't seem to work. And I do not get errors, but the CycleRange values are not populating the NewFoundRange values at the lower part of the code.

    Please Login or Register  to view this content.
    Any ideas? Do I need to set NewFundRange differently? I have not used the DIM function to set them to anything. I use Excel 2010. Thank you for taking a look at this thread.
    Last edited by starcraftbud; 10-11-2013 at 11:47 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Setting a variable range with a variable sheet name. Hmm?

    What is " mark in

    Please Login or Register  to view this content.
    ?

  3. #3
    Registered User
    Join Date
    02-20-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    92

    Re: Setting a variable range with a variable sheet name. Hmm?

    I'm not completely sure I understand the question, but thanks for the response and I'll try to answer as best I can. That is definitely the line of code where I think there is an issue. I'm not sure if I've used the " correctly. I just use the " and the & symbol to refer to declared objects. Its what I normally do, but it could be wrong in this instance.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Setting a variable range with a variable sheet name. Hmm?

    If it is a sheet name, you should use the same format as the one you have:

    Please Login or Register  to view this content.
    Should be sheets("sheetname")

    sheetname is string. A string should be in " "
    The sheetname should be in quotation mark and should not be any space. Names are also case sensitive
    The easiest way to avoid any error is to copy the sheet name from the sheet itself and paste it in

    Please Login or Register  to view this content.
    That is replace "" & CycleRange & ""

  5. #5
    Registered User
    Join Date
    02-20-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    92

    Re: Setting a variable range with a variable sheet name. Hmm?

    Thanks for the feedback guys. I was able to figure it out. I feel quite foolish, it was just a typo in my code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] setting a range as a variable
    By Zealotwraith in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-09-2013, 12:27 PM
  2. setting sheet as variable
    By HarryKlein in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2012, 07:05 AM
  3. setting a range variable
    By Lazhal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2010, 01:50 PM
  4. Setting up variable summary sheet.
    By shakey1181 in forum Excel General
    Replies: 4
    Last Post: 08-18-2006, 08:40 AM
  5. [SOLVED] Setting a Variable range in VBA
    By The Hawk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-04-2006, 10:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1