how do i type something in a cell using vba?

Discussion in 'Microsoft Excel Programming' started by Giorgio, Jul 10, 2008.

  1. Giorgio

    Giorgio Guest

    in a vba code, i use worksheets.()value... to attribute a value to a
    variable. is that correct? and how do i actually print something a variable
    contains, like eg sum=123 and i want to print 123 in cell A3 in worksheet Raw
    of workbook 1.xls. funnily, i cannot get this answer in simple help of
    office. a rookie in vba, i must admit! thanks
     
    Giorgio, Jul 10, 2008
    #1
    1. Advertisements

  2. Giorgio

    Per Jessen Guest

    On 10 Jul., 22:44, Giorgio <> wrote:
    > in a vba code, i use worksheets.()value... to attribute a value to a
    > variable. is that correct? and how do i actually print something a variable
    > contains, like eg sum=123 and i want to print 123 in cell A3 in worksheet Raw
    > of workbook 1.xls. funnily, i cannot get this answer in simple help of
    > office. a rookie in vba, i must admit! thanks


    Hi

    Sum = 123
    Worksheets("Raw").Range("A3") = Sum

    Reards,
    Per
     
    Per Jessen, Jul 10, 2008
    #2
    1. Advertisements

  3. Giorgio

    salgud Guest

    On Thu, 10 Jul 2008 13:44:04 -0700, Giorgio wrote:

    > in a vba code, i use worksheets.()value... to attribute a value to a
    > variable. is that correct? and how do i actually print something a variable
    > contains, like eg sum=123 and i want to print 123 in cell A3 in worksheet Raw
    > of workbook 1.xls. funnily, i cannot get this answer in simple help of
    > office. a rookie in vba, i must admit! thanks


    simplest way is something like:
    activesheet.range.("A3") = sum
    Substitute the real spreadsheet name for "activesheet".
    There are lot of other ways to do this, depending on the context.
    Hope this helps in your world.
     
    salgud, Jul 11, 2008
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. y

    Something works, something don't.

    y, Apr 6, 2004, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    348
    Wei-Dong XU [MSFT]
    Apr 7, 2004
  2. petros89

    Using VB to type something into a cell

    petros89, Nov 29, 2005, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    197
    Jef Gorbach
    Nov 29, 2005
  3. Guest

    Testing for type of cell value using Excel VBA

    Guest, Oct 9, 2006, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    397
    Guest
    Oct 9, 2006
  4. CAPTGNVR
    Replies:
    2
    Views:
    1,263
    Gary Keramidas
    Jul 8, 2007
  5. PCLIVE

    VBA to say IF cell = any one of 3 values,then do something

    PCLIVE, Sep 10, 2007, in forum: Microsoft Excel Programming
    Replies:
    8
    Views:
    274
    Dana DeLouis
    Sep 15, 2007
  6. Replies:
    5
    Views:
    590
    Rick Rothstein \(MVP - VB\)
    Jun 28, 2008
  7. u473

    VBA Import Convert Data Type from Type 1 to Type 2

    u473, Oct 20, 2008, in forum: Microsoft Excel Programming
    Replies:
    3
    Views:
    2,771
  8. AFSSkier

    VBA Code for converting Type-E UPC to Type-A (barcodes)

    AFSSkier, Dec 31, 2009, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    1,638
    Rick Rothstein
    Dec 31, 2009
Loading...