Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Howard Dixon   on Nov 14 In MS Office Category.

  
Question Answered By: Rosalie Holmes   on Nov 14

You do set ws as a reference to the appropriate sheet, but then you don't
use it. All you do is we.Activate and then trust to luck that it stays
activated. You should make sure that you actually specify ws as a prefix to
every action that access a worksheet. Once you do that, you won't even need
the we.Activate unless you actually want to bring the sheet to the
foreground so you can see it yourself.

I'm not sure why you are using a cell to hold the row number in, rather than
a VBA variable. But if you aren't initialising it when you change pages,
presumably that will give you problems.

You seem to have a straight debugging problem here. Set breakpoints in your
code and step it through - paying attention to the values in the various
variables - particularly immediately after page changes.

Before you do too much debugging, customise the VB environment toolbars to
make sure you have icons for "step over", "step into", "step out" (of
current sub or function) and "run to cursor". They do have hot-keys, but
it's often easier to click on the toolbar, and most frustrating to try to
use them from the Debug menu item.

Also make sure that your have Option Explicit at the top of every module to
ensure that all of your variables are defined correctly and that typos don't
make trouble.

Share: 

 

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

 
Didn't find what you were looking for? Find more on Multi-tab form Or get search suggestion and latest updates.


Tagged: