Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default how to effect multiple sheets at one time.

Hello everyone,

I have a spreadsheet that is used to track employee absence. At the end of
each year accounting will take the sheet and archive it. Since we hire new
people we are adding sheets throughout the year. I need to add a second
archive button that can effect only specific sheets. What I want to do is
take the date of hire (C5) and compare it to a date I will hard code into
the macro. If the date of hire is before the hard coded date I want the
program to copy and past the absences to a lower position in the sheet. Then
clear out the absences from the top. I will be placing this button on the
main sheet so punching it will have to search all tabs in the sheet and
check that cell.

the value C5 is pointing to the main sheet. Which is an index of the
employees and is there for quick viewing. I don't know how to go from sheet
to sheet with the macro.

All help is deeply appreciated.
LWhite


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default how to effect multiple sheets at one time.

dim wks as worksheet
for each wks in activeworkbook.wks
'do what you need to to wks
if wks.range("C5").value < dateserial(2005,1,31) then
'do the copy/move
end if
next wks

or maybe....

dim wks as worksheet
for each wks in activeworkbook.wks
if lcase(wks.name) = lcase("main") then
'do nothing
else
'do what you need to to wks
if worksheets("main").range("C5").value < dateserial(2005,1,31) then
'do the copy/move
end if
end if
next wks

====
I'm confused about what's in C5 and where it is???

"L.White" wrote:

Hello everyone,

I have a spreadsheet that is used to track employee absence. At the end of
each year accounting will take the sheet and archive it. Since we hire new
people we are adding sheets throughout the year. I need to add a second
archive button that can effect only specific sheets. What I want to do is
take the date of hire (C5) and compare it to a date I will hard code into
the macro. If the date of hire is before the hard coded date I want the
program to copy and past the absences to a lower position in the sheet. Then
clear out the absences from the top. I will be placing this button on the
main sheet so punching it will have to search all tabs in the sheet and
check that cell.

the value C5 is pointing to the main sheet. Which is an index of the
employees and is there for quick viewing. I don't know how to go from sheet
to sheet with the macro.

All help is deeply appreciated.
LWhite


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default how to effect multiple sheets at one time.

Thanks Dave.

Each sheet has the following value in C5.

='Index'!B21

Index is the name of the master tab of the sheet that shows the totals
from each individual employee. In column B is each employees date of
hire.

Leonard

Dave Peterson wrote:
dim wks as worksheet
for each wks in activeworkbook.wks
'do what you need to to wks
if wks.range("C5").value < dateserial(2005,1,31) then
'do the copy/move
end if
next wks

or maybe....

dim wks as worksheet
for each wks in activeworkbook.wks
if lcase(wks.name) = lcase("main") then
'do nothing
else
'do what you need to to wks
if worksheets("main").range("C5").value < dateserial(2005,1,31) then
'do the copy/move
end if
end if
next wks

====
I'm confused about what's in C5 and where it is???


Dave Peterson


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default how to effect multiple sheets at one time.

So you could use the first suggestion and check the "local" copy.

Or you could use the second suggestion and check the value on the index
worksheet (with a minor modification):

if worksheets("main").range("C5").value < dateserial(2005,1,31) then
becomes
if worksheets("index").range("b21").value < dateserial(2005,1,31) then

I would think that they would work the same.

LWhite wrote:

Thanks Dave.

Each sheet has the following value in C5.

='Index'!B21

Index is the name of the master tab of the sheet that shows the totals
from each individual employee. In column B is each employees date of
hire.

Leonard

Dave Peterson wrote:
dim wks as worksheet
for each wks in activeworkbook.wks
'do what you need to to wks
if wks.range("C5").value < dateserial(2005,1,31) then
'do the copy/move
end if
next wks

or maybe....

dim wks as worksheet
for each wks in activeworkbook.wks
if lcase(wks.name) = lcase("main") then
'do nothing
else
'do what you need to to wks
if worksheets("main").range("C5").value < dateserial(2005,1,31) then
'do the copy/move
end if
end if
next wks

====
I'm confused about what's in C5 and where it is???


Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to effect all sheets...ThisWorkbook? JSnow Excel Discussion (Misc queries) 4 December 17th 08 10:05 PM
Is there a way to unhide multiple sheets at one time? Catharine Excel Discussion (Misc queries) 2 July 13th 06 05:50 PM
Can I unhide multiple sheets at one time? Rick J Excel Discussion (Misc queries) 3 February 28th 06 02:04 AM
Protect multiple sheets in one time Henk Frigge Excel Programming 4 June 29th 05 01:16 PM
HOW CAN I CHANGE SET-UP ON MULTIPLE SHEETS AT 1 TIME? DEMONET48 Setting up and Configuration of Excel 0 January 14th 05 07:53 PM


All times are GMT +1. The time now is 12:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"