+ Reply to Thread
Results 1 to 4 of 4

Variables copied into worksheet cells?

Hybrid View

  1. #1
    Registered User
    Join Date
    11-01-2007
    Location
    UK
    Posts
    2

    Variables copied into worksheet cells?

    This seems like a really simple question but I can't for the life of me figure out how to copy a variable into a cell.

    In other words, say I have a variable with a value of 5. How would I display that value (5) in cell B4 on worksheet "Data"?

    Thanks for you help. I've spent about an hour trying to figure this one out so far. Yes, I am a beginner

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Welcome to the forum.
    And welcome to VBA for Excel.
    ThisWorkbook.Sheets("Data").Range("B4").Value = 5
    is one of the many ways to do what you want.
    The VBEditor help system, keyword:"How to reference cells and ranges" is a gateway to the other ways. (May be different keyword in 2007.)

  3. #3
    Registered User
    Join Date
    11-01-2007
    Location
    UK
    Posts
    2
    Thanks, Mike. That's just what I wanted.

    Just another quick question. If I substituted the value 5 for a variable name would it still work?

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    What happened when you tried 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