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.

Share This Page