Results 1 to 4 of 4

Thread: Output to a cell (Excel)

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Unhappy Output to a cell (Excel)

    Hi i have a form where the user enters data i am using the VB toolbox

    How can i make this export to a cell such as H8 here is some code i am using for example

    VB Code:
    1. dim stockamnt as integer
    2.  stockamnt = Val(TxtNoin.Text) 'textbox to enter stock level
    3.   stockamnt = stockamnt - 1 ' decrease level by one
    4.   TxtPrice.Text = stockamnt 'set textbox value to varible
    5.        ' i need code here to place the value of stockamnt to a cell

    Keep the code simple please cos i know little VBA


    Thanks all
    Sam Lad

  2. #2
    New Member
    Join Date
    May 2003
    Posts
    8
    dim stockamnt as integer
    stockamnt = Val(TxtNoin.Text) 'textbox to enter stock level
    stockamnt = stockamnt - 1 ' decrease level by one
    TxtPrice.Text = stockamnt 'set textbox value to varible
    ' i need code here to place the value of stockamnt to a cell


    ' code:

    Cells(lRow, lColumn).Value = txtPrice.Text

    ' this will assign the value in txtPrice to the cell given the row, and column coordinates


    ZeBula

  3. #3

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    VB Code:
    1. Cells(8, H).Value = TxtPrice.Text
    Causes a error which is


  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    you need to use the column Number, not the name.

    so H8 is:
    Cells(8, 8).Value = TxtPrice.Text

    and H9 is:
    Cells(9, 8).Value = TxtPrice.Text

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width