Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Rainhard Fischer   on Feb 19 In MS Office Category.

  
Question Answered By: Mable Stone   on Feb 19

Firstly, and most important, put the following at the top of every code module:

Option Explicit

This will ensure that you define all variables properly. (Excel VBA editor can
be configured to put this line in automatically. In Excel 2000, the option you
need to set is "Require variable declaration".)

You don't say where you're putting your code. Assuming you have created a new
form, this code needs to go into the code module for that form. As such,
Text1.Text will refer correctly to a text  box called Text1 on your form.

xlsheet.Cells(2, 1) is a reference to cell(2, 1) of a sheet  that is pointed to
by variable xlsheet. You will need to have defined and set xlsheet to point to
the sheet you want, presumably the active sheet. Easier is just to use
ActiveSheet.Cells(2,1). From memory, Cells(2,1) will default to the active
sheet anyway.

You don't say what errors you are getting when you run  your code. Are you
getting any?

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Textbox - simple question? Or get search suggestion and latest updates.


Tagged: