LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default reusing code


Hi, The code below needs to be used on seven worksheets (Mon - Sun).

How can I resuse this code for each day of the week? I thought I
could just set the wksdump to Tuesday etc. I also need to change the
column I select in the array for each day (+1 column) - this is the
last few lines of code where 7 will need to become 8 for Tuesday, 9
for Wednesday etc.
I have only included here the code which needs to be reused.



Dim i As Integer
Dim j As Integer

Set wksDump = ThisWorkbook.Sheets("Staff Monday")

wksDump.Cells.ClearContents

'input header column
wksDump.Cells(1, 1).Value = "Name"
wksDump.Cells(1, 2).Value = "Status"
wksDump.Cells(1, 3).Value = "Start"
wksDump.Cells(1, 4).Value = "End"
wksDump.Cells(1, 5).Value = "Shift"
wksDump.Cells(1, 6).Value = "Description"
wksDump.Cells(1, 7).Value = "06:00"

'input times in header column
For i = 7 To 114
wksDump.Cells(1, i).Value = TimeofDay
TimeofDay = TimeofDay + 0.006944444444
Next i

'input times in header column (past midnight)
For i = 115 To 150
wksDump.Cells(1, i).Value = Midnight
Midnight = Midnight + 0.006944444444
Next i


For i = 2 To LastRow
For j = 1 To 1 'j = columns
wksDump.Cells(i, j) = AWD_Array(i, 2)
Next j
Next i

For i = 2 To LastRow
For j = 2 To 2
wksDump.Cells(i, j) = AWD_Array(i, 7)
Next j
Next i

Thanks,
Matt
 
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
Reusing Form Code DMc2004 Excel Programming 4 November 16th 07 05:33 PM
Reusing formula Tony29 Excel Discussion (Misc queries) 7 September 7th 06 03:34 AM
Reusing grouping of non-adjacent cells [email protected] Excel Discussion (Misc queries) 2 May 28th 06 01:21 PM
reusing a recordset for a pivot-table? Bart op de grote markt Excel Programming 2 March 7th 06 03:34 PM
reusing a recordset for a pivot-table [email protected] Excel Programming 2 February 28th 06 03:36 PM


All times are GMT +1. The time now is 08:01 AM.

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

About Us

"It's about Microsoft Excel"