[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Re: Sheet referencing in a macro

Craig B

12/18/2006 9:43:00 PM

use sheets(1) or sheets(2) to select those two sheets, they will always
be the first two sheets in the workbook, or name them something, like
"Data 1" and "Data 2" and then refer to them that way, Sheets("Data
1").select

Sheets("Data 2").select



On Dec 18, 3:31 pm, LouP <L...@discussions.microsoft.com> wrote:
> I am trying to write a macro that always references the first two sheets and
> I am adding new sheets daily to the workbook. I am naming the sheets with
> the date they were added to the workbook. Is there a way to reference the
> sheets that are always on the first two tabs? Remember that new tabs are
> being added daily and I can't use Sheet1 as the newest sheet is given the
> last number regardless of the tab order.
>
> Lou

1 Answer

Lou P

12/19/2006 5:56:00 PM

0

I am adding new sheets daily and need to reference the new sheet and the old
sheets. The new sheet that was there previously becomes the old sheet and I
still have reference to my "older" sheets in the macro. I tried to name the
sheets but all my formulas are changing when I rename the sheets to make way
for the latest one coming in (I was using "Current" and "Prior"). I am
trying to develop this so someone with very little excel skills can take this
task over. Also, Some very old sheets get removed as time goes on to keep
the file size down. The whole thing is very dynamic and idealy I would like
to be able to reference the tab most furthest to the left and then the next
one to the right and then the third one to the right. I hope that this helps
clarify what I am trying to do.

LouP

"Craig B" wrote:

> use sheets(1) or sheets(2) to select those two sheets, they will always
> be the first two sheets in the workbook, or name them something, like
> "Data 1" and "Data 2" and then refer to them that way, Sheets("Data
> 1").select
>
> Sheets("Data 2").select
>
>
>
> On Dec 18, 3:31 pm, LouP <L...@discussions.microsoft.com> wrote:
> > I am trying to write a macro that always references the first two sheets and
> > I am adding new sheets daily to the workbook. I am naming the sheets with
> > the date they were added to the workbook. Is there a way to reference the
> > sheets that are always on the first two tabs? Remember that new tabs are
> > being added daily and I can't use Sheet1 as the newest sheet is given the
> > last number regardless of the tab order.
> >
> > Lou
>
>