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: Walborgd Fischer   on Nov 14

I don't know why your code isn't doing what you want, at a casual glance,
but I recommend you take a different approach to handling your worksheets.

Relying on "active sheet" is not a good idea. And in fact you have a
mixture of "active sheet" and "object" accesses to your sheets.

What I believe you should do is define as many WorkSheet variables as you
have worksheets. Right at the beginning, set each of these to be a
reference to their respective worksheets. (If you like, you could even
create an array of WorkSheet references, aligned with the MultiPage1.Value
values. Then you can just use the page number as an index into the
WorkSheet references array.)

Then, use these WorkSheet variables in dot notation for each reference to
Range, Cells, etc. For subroutines, pass the particular WorkSheet variable
as a parameter. Or possibly store it in a global "ws" variable.

Don't forget the With phrase, which you can use to avoid repeating the
WorkSheet reference over and over again.

Just scanning your code again, I can't see where you initialise RowNumber
when you change pages.

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: