+ Reply to Thread
Results 1 to 5 of 5

Proper use of Commas and Ampersands in relation to variables in VBA code.

  1. #1
    Registered User
    Join Date
    11-17-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    69

    Proper use of Commas and Ampersands in relation to variables in VBA code.

    I have a cell (L1) on a sheet named "Transaction Listing" within a file which records a month name eg. March. There are a number of sheets in this file for each month eg. January Rec, February Rec, March Rec. The code below is supposed to pick up whichever sheet name is referred to at cell "L1" on the Transaction Listing sheet. However, I am doing something wrong in relation to the "Sheets(" & MySelectedMonth & " " & Rec").Select" as I keep getting the error message "Expected: list separator or )". Anyone able to tell me where I am going wrong? Thank you.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Proper use of Commas and Ampersands in relation to variables in VBA code.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-17-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    69

    Re: Proper use of Commas and Ampersands in relation to variables in VBA code.

    Thank you so much for that, very much appreciated, I understand what you have done, the only thing I am wondering is this - I note that there is a space between the " and Rec, is this the space that would normally be between say "March Rec"?

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Proper use of Commas and Ampersands in relation to variables in VBA code.

    is this the space that would normally be between say "March Rec"?
    That is correct.

  5. #5
    Registered User
    Join Date
    11-17-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    69

    Re: Proper use of Commas and Ampersands in relation to variables in VBA code.

    Terrific, many thanks stnkynts, have a lovely Easter.

+ 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. Replies: 4
    Last Post: 03-14-2014, 07:46 AM
  2. [SOLVED] Formula to display data between ampersands
    By greyscale in forum Excel General
    Replies: 2
    Last Post: 08-19-2012, 11:28 PM
  3. Changing layout of sheet in relation to vba code
    By moo moo cow in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-10-2012, 07:35 AM
  4. check if cell contains 3 ampersands in it at any location
    By johnmerlino in forum Excel General
    Replies: 5
    Last Post: 01-13-2011, 10:00 AM
  5. Making proper names out of concatenated string variables
    By TryToExcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2010, 06:25 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