Dear Peter,
This is SOOOOOOO Awesome! I had no idea something like this could exist. It cuts down on my long lists of codes. Thanks so much!!
But, I was wondering, is there a limit to how large my spreadsheet can be? I added all my housekeeper's names to the spreadsheet and everything works perfectly until the last two names starting on column BO.
Thanks in advance for your help!
-A. Smith
Code:
Sub ACTIVATEHOUSEKEEPERmrexcel()
Dim inputData As String, Prmpt As String
Dim Housekeepers As Variant
Dim HKNum As Long
Const ColsPerHK As Long = 5 '<- Number of columns per HK
Const FirstCol As Long = 7 '<- Column for first HK
Housekeepers = Array("YARITZA", "MARILUZ", "KYANDRA", "KELLY", "MARIA", "ANA", "ENEDELIA", "SIMONE", "MARINA", "ERIKA", "GRISELDA", "DEJA", "LOURDES", "APRIL", "OTHER") '<- List of HKs (case doesn't matter)
Prmpt = "Enter Housekeeper's Name"
Do
inputData = Application.InputBox(Prmpt)
If UCase(inputData) = "FALSE" Then
MsgBox "OK,cancelled"
Exit Sub
End If
On Error Resume Next
HKNum = Application.Match(inputData, Housekeepers, 0)
On Error GoTo 0
Prmpt = "Incorrect name, please try again"
Loop Until HKNum > 0
ActiveWindow.ScrollColumn = FirstCol + (HKNum - 1) * ColsPerHK
End Sub
[TABLE="width: 5129"]
<tbody>[TR]
[TD="class: xl73, width: 103, bgcolor: transparent"]
SEP 2017
[/TD]
[TD="width: 410, bgcolor: transparent, colspan: 5, align: left"]
<v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o
referrelative="t" o:spt="75" coordsize="21600,21600">
<v:stroke joinstyle="miter"> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"> <v:f eqn="sum @0 1 0"> <v:f eqn="sum 0 0 @1"> <v:f eqn="prod @2 1 2"> <v:f eqn="prod @3 21600 pixelWidth"> <v:f eqn="prod @3 21600 pixelHeight"> <v:f eqn="sum @0 0 1"> <v:f eqn="prod @6 1 2"> <v:f eqn="prod @7 21600 pixelWidth"> <v:f eqn="sum @8 21600 0"> <v:f eqn="prod @7 21600 pixelHeight"> <v:f eqn="sum @10 21600 0"> </v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:formulas> <vath o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"> <o:lock aspectratio="t" v:ext="edit"> </o:lock></vath></v:stroke></v:shapetype>
<tbody>
[TD="class: xl89, colspan: 5"]
DAILY TOTALS
[/TD]
</tbody>
[/TD]
[TD="class: xl74, colspan: 4"]
YARITZA
[/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl74, colspan: 3"]
MARILUZ
[/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl74, colspan: 3"]
KYANDRA
[/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl75"][/TD]
[TD="class: xl74, width: 270, bgcolor: transparent, colspan: 3"]
KELLY
[/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl75"][/TD]
[TD="class: xl74, width: 180, bgcolor: transparent, colspan: 2"]
MARIA
[/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl75"][/TD]
[TD="class: xl74, width: 180, bgcolor: transparent, colspan: 2"]
ANA
[/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl75"][/TD]
[TD="class: xl74, width: 270, bgcolor: transparent, colspan: 3"]
ENEDELIA
[/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl75"][/TD]
[TD="class: xl74, width: 180, bgcolor: transparent, colspan: 2"][/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl75"][/TD]
[TD="class: xl74, width: 270, bgcolor: transparent, colspan: 3"]
MARINA
[/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl74, colspan: 2"]
ERIKA
[/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl87"][/TD]
</tbody>
[/TD]
[TD="class: xl74, colspan: 3"]
GRISELDA
[/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl87"][/TD]
</tbody>
[/TD]
[TD="class: xl74, colspan: 2"]
DEJA
[/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl87"][/TD]
</tbody>
[/TD]
[TD="class: xl75"]
APRIL
[/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="width: 90, bgcolor: transparent, align: left"]
<tbody>
[TD="class: xl75"][/TD]
</tbody>
[/TD]
[TD="class: xl74"]
OTHER
[/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="class: xl75, width: 90, bgcolor: transparent"][/TD]
[TD="class: xl87, width: 90, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl80"]DATE
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl68"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl65"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl68"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl68"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl68"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl68"]HRS VAR
[/TD]
[TD="class: xl66"]STY OVR
[/TD]
[TD="class: xl67"]CHK OUT
[/TD]
[TD="class: xl65"]HRS WRK
[/TD]
[TD="class: xl65"]HRS ALW
[/TD]
[TD="class: xl68"]HRS VAR
[/TD]
[/TR]
[TR]
[TD="class: xl81"]10/01/17
[/TD]
[TD="class: xl86"]53.00
[/TD]
[TD="class: xl86"]33.00
[/TD]
[TD="class: xl86"]29.75
[/TD]
[TD="class: xl85"]10.75
[/TD]
[TD="class: xl72"]19.00
[/TD]
[TD="class: xl69, bgcolor: transparent"]7
[/TD]
[TD="class: xl70, bgcolor: transparent"]7
[/TD]
[TD="class: xl71, bgcolor: transparent"]7.50
[/TD]
[TD="class: xl82"]5.25
[/TD]
[TD="class: xl82"]-2.25
[/TD]
[TD="class: xl69, bgcolor: transparent"]14
[/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"]3.25
[/TD]
[TD="class: xl82"]3.50
[/TD]
[TD="class: xl82"]0.25
[/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69, bgcolor: transparent"]9
[/TD]
[TD="class: xl70, bgcolor: transparent"]6
[/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"]5.25
[/TD]
[TD="class: xl82"]HRS WRK
[/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69, bgcolor: transparent"]8
[/TD]
[TD="class: xl70, bgcolor: transparent"]6
[/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"]5.00
[/TD]
[TD="class: xl82"]HRS WRK
[/TD]
[TD="class: xl69, bgcolor: transparent"]7
[/TD]
[TD="class: xl70, bgcolor: transparent"]7
[/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"]5.25
[/TD]
[TD="class: xl82"]HRS WRK
[/TD]
[TD="class: xl69, bgcolor: transparent"]8
[/TD]
[TD="class: xl70, bgcolor: transparent"]7
[/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"]5.50
[/TD]
[TD="class: xl82"]HRS WRK
[/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl88"][/TD]
[TD="class: xl69, bgcolor: transparent"]7
[/TD]
[TD="class: xl70, bgcolor: transparent"]7
[/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"]5.25
[/TD]
[TD="class: xl88"]HRS WRK
[/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl88"][/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl88"][/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl88"][/TD]
[/TR]
[TR]
[TD="class: xl81"]10/02/17
[/TD]
[TD="class: xl84"]28.00
[/TD]
[TD="class: xl84"]15.00
[/TD]
[TD="class: xl84"]14.50
[/TD]
[TD="class: xl83"][/TD]
[TD="class: xl72"]14.50
[/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl69"]10
[/TD]
[TD="class: xl70"]6
[/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"]5.50
[/TD]
[TD="class: xl82"]HRS WRK
[/TD]
[TD="class: xl69"]14
[/TD]
[TD="class: xl70"]3
[/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"]5.00
[/TD]
[TD="class: xl82"]HRS WRK
[/TD]
[TD="class: xl69"]4
[/TD]
[TD="class: xl70"]6
[/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"]4.00
[/TD]
[TD="class: xl88"]HRS WRK
[/TD]
[TD="class: xl69"]10
[/TD]
[TD="class: xl70"]6
[/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"]5.50
[/TD]
[TD="class: xl88"]HRS WRK
[/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl88"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl88"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl70"][/TD]
[TD="class: xl71"][/TD]
[TD="class: xl82"][/TD]
[TD="class: xl88"][/TD]
[/TR]
</tbody>[/TABLE]