Adapting code to copy names on a roster

ME1960

New Member
Joined
Oct 4, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
I have used the pasted code for over 15 years to generate a daily sheet

****************************************
'* Daily Sheet Builder
'* BY M J EDGE
'* 16-12-2006
'* mods 1 - 3
'****************************************


Sub AnyDay()

Application.ScreenUpdating = False
Dim A$, b$, c$
Dim i
Dim Loop1 As Integer
Sheet12.Activate


For Loop1 = 1 To 7
Select Case Loop1
Case 1 'Monday
A$ = "C"
x = 3
Case 2 'Tuesday
A$ = "D"
x = 4
Case 3 'Wednesday
A$ = "E"
x = 5
Case 4 'Thursday
A$ = "F"
x = 6
Case 5 'Friday
A$ = "G"
x = 7
Case 6 'Saturday
A$ = "H"
x = 8
Case 7 'Sunday
A$ = "I"
x = 9
End Select
Sheet12.Activate
For i = 1 To 80
c$ = A$ & (i + 0) 'use the a$ Luke
Range(c$).Select
If ActiveCell.Value = "AD" Then
b$ = "A" & (i + 0)
Range(b$).Select
ActiveCell.Copy
Sheets(x).Activate
Range("F33").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End If
Next i

Sheet12.Activate
For i = 1 To 80
c$ = A$ & (i + 0) 'use the a$ Luke
Range(c$).Select
If ActiveCell.Value = "AD1" Then
b$ = "A" & (i + 0)
Range(b$).Select
ActiveCell.Copy
Sheets(x).Activate
Range("F34").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False[/CODE]
End If
Next i

This is an extract of the code that works perfectly if the roster is as follows

Landside Roster
Group 1ManLineMonTueWedThuFriSatSun
DriverNoNo4-Oct5-Oct6-Oct7-Oct8-Oct9-Oct10-Oct
W Clarkson
1​
ADAD2AD3ADAD1
S Wild
2​
N1N12N8N3
S Goddard
3​
M1M17M10SM3
G Coughlan
4​
N1N15SN2N3
L Swire
5​
AD4AD3AD2
J Whatling
6​
AD1N1N14
C Sinclair
7​
AD2N3M3
J Greenwood/E McDonagh
8​
M11M4SM3
M McLean
9​
N1N13SN2N14
S Burrage
10​
M1M14M9M17
N Bell
11​
N15SN2N10N14
N Burke
12​
M3M11M8M1
Y Haji/J Copeland
13​
M15N1N11N8
C Lee
14​
N16M10M16
T McGovern
15​
M8M3N1
V DeLury
16​
N11N8N3

I have now changed company and the roster has changed again an extract

CD Roster10
xMonTueWedThuFriSatSun
1​
ADBDCDDD
2​
ANBNCNDN
Blue 10
3​
ADBDCDDD
4​
ANBNCNDN
5​
ADBDCD
6​
DDANBN
Orange 1
7​
CNDNAD
8​
BDCDDD
9​
ANBNCNDN
10​
ADBDCDDD
Green 1
11​
ANBNCNDN
12​
ADBDCDDD
13​
ANBNCN
14​
DNADBD
Yellow 1
15​
CDDDAN
16​
BNCNDN
17​
AD1BD1CD1DD1
18​
AN1BN1CN1DN1
Blue 1
19​
AD1BD1CD1DD1
20​
AN1BN1CN1DN1
21​
AD1BD1CD1
22​
DD1AN1BN1
Orange 2
23​
CN1DN1AD1
24​
BD1CD1DD1
25​
AN1BN1CN1DN1
26​
AD1BD1CD1DD1
Green 2
27​
AN1BN1CN1DN1
28​
AD1BD1CD1DD1
29​
AN1BN1CN1
30​
DN1AD1BD1
Yellow 2
31​
CD1DD1AN1
32​
BN1CN1DN1
33​
AD2BD2CD2DD2
34​
AN2BN2CN2DN2
Blue 2
35​
AD2BD2CD2DD2
36​
AN2BN2CN2DN2
37​
AD2BD2CD2
38​
DD2AN2BN2
Orange 3
39​
CN2DN2AD2
40​
BD2CD2DD2
41​
AN2BN2CN2DN2
42​
AD2BD2CD2DD2
Green3
43​
AN2BN2CN2DN2
44​
AD2BD2CD2DD2
45​
AN2BN2CN2
46​
DN2AD2BD2
Yellow 3
47​
CD2DD2AN2

what I need to change is if it finds say AD on Monday and its a blank in column A skip to the next instance of AD on Monday until it finds a name in column A and copy that to the daily sheet. I am sure that my current code can be adapted but just seem to have forgot so much in the intervening years.

Thanks in advance
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,214,909
Messages
6,122,189
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top