Add data to sheet from userform with row number specified in textbox.

  • Hi all,


    My first post, so hello and thanks in advance.


    I'm getting back into excel after a long time away, and am stumped.


    I have a sheet which I plan to use for stock control, I have done the data entry and search, but on one of the forms I need to load and edit data from a row number which is specified within a textbox on a userform.


    I don't know how to reference that row within VBA, the column doesn't need to be dynamic - just the row.


    FYI, the textbox is called "txtrow" and the userform "frmStock" then I need to load sheet5, column A and the row number from txtrow.


    Any help would be greatly appreciated.

  • Re: Add data to sheet from userform with row number specified in textbox.


    Code
    sheets("sheet5").cells(clng(txtrow.value),"A").value =…
  • Re: Add data to sheet from userform with row number specified in textbox.


    Quote from p45cal;774166
    Code
    sheets("sheet5").cells(clng(txtrow.value),"A").value =…



    Thanks, but this returns an error - Runtime error 424, Object required.

  • Re: Add data to sheet from userform with row number specified in textbox.


    Supply the file and I'll put it in for you.
    Of course, the [COLOR="#0000FF"]=… [/COLOR]needs to be adjusted to whatever you want to put in that cell.

  • Re: Add data to sheet from userform with row number specified in textbox.


    I have adjusted the = to the value of textbox1 from the same userform.


    Sorry, due to the data on the sheet I am unable to share it.


    I have realised that I was initially refering the the textbox incorrectly, having now corrected that the error is "Subscript out of range".


    EDIT!


    I have now solved it, it wasn't your code - It was my sheet reference!


    Thanks for your help p45, greatly appreciated!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!