Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 752
  • Last Modified:

Transfer data from a VBA userform to an Excel spreadsheet

I am trying to make the data that will be inserted in my userform automatically gets stored into designated cells in my excel spreadsheet so that the user can have records that can be retrieved later. My main problem is finding the correct codes that allow the data i enter to be plugged in the desired sheet.
thank you

1 Solution
The syntax for refrencing a particular cell in an excel worksheet using VBA is


In the above command, u will have to use the RC format for refrencing a particular cell n not the default A1 format. for example if u want to refrence the cell B2, so this will be refrenced as (2,2), ie; 2nd row 2nd column. similarly D5 will be refrenced as (5,4).

Now, assuming u are receiving data from the user in a textbox named Text1 and the name of the worksheet into which u want to enter the data is Sheet1, and the cell into which the data has to be entered is B10, then the following syntax will be used

Worksheets("Sheet1").Cells(10,2).Value = Text1.Text

Hope this answers ur question.
One further point:
If you want the data to go to the worksheet immediately you change the textbox, you could use Text1_Change to trigger the transfer. Or you could leave it until you exit the form, if, say, you have a number of changes to make.
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now