+ Reply to Thread
Results 1 to 3 of 3

set a variable = to a range "-" (dash) range

  1. #1
    Registered User
    Join Date
    07-05-2012
    Location
    Ontario, Canade
    MS-Off Ver
    Excel 2010
    Posts
    88

    set a variable = to a range "-" (dash) range

    Hey,

    I have tried setting my variable to to be equal to one range dash another range, but it picks it up as minus, and since it is text, i get an error.

    eg

    x= Sheets("Page 1").Range("C8").Value-Sheets("Page 3").Range("E8").Value

    I want it to look like this eg,

    BlueWater Investment-Aggressive variant strategy

    thanks,

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: set a variable = to a range "-" (dash) range

    How about...
    Dim X as String
    X = Sheets("Page 1").Range("C8").Text & "-" & Sheets("Page 3").Range("E8").Text
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    07-05-2012
    Location
    Ontario, Canade
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: set a variable = to a range "-" (dash) range

    works like a charm, I tried it in quotations, but i didnt have the & around it. thanks for the help appreciate it!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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