I am trying to select a specific sheet based on a value. I have the clients list setup with the sheet name for that client next to it. Finding the name of the sheet from the list is working, but when I try to set the worksheet variable, it errors out. Here is the code I am using:
Public Sub SeparateClients()
Dim MainL As Range: Set MainL = ML.Range("A2", ML.Range("A2").End(xlDown))
Dim ClientsF As Range
Dim cClientS As String
Dim cClient As Worksheet
Dim cClientNR As Range
For Each MainL In MainL.Cells
    If MainL.Value = "" Then Exit For
    Set ClientsF = CL.Range("A:A")
    If ClientsF.Find(MainL.Offset(0, 1).Value, , , xlWhole) Is Nothing Then
        MsgBox "Client not found: " & MainL.Offset(0, 1).Value, vbOKOnly, "ERROR: Client not found"
    Else
        cClientS = ClientsF.Find(MainL.Offset(0, 1).Value, , , xlWhole).Offset(0, 1).Value
        Set cClient = Sheets(cClientS)
        Set cClientNR = cClient.Range("A1").End(xlDown).Offset(1, 0)
        
        With cClientNR
            .Value = MainL.Offset(0, 3).Value
            .Offset(0, 1).Value = MainL.Offset(0, 5).Value
            .Offset(0, 2).Value = Mid(MainL.Offset(0, 6).Text, 1, 10)
            .Offset(0, 3).Value = MainL.Offset(0, 8).Value
            .Offset(0, 4).Value = MainL.Offset(0, 15).Value
            .Offset(0, 5).Value = MainL.Offset(0, 17).Value
            .Offset(0, 6).Value = MainL.Offset(0, 23).Value
            .Offset(0, 7).Value = MainL.Offset(0, 28).Value
        End With
    End If
Next MainL
End Sub
When it gets to set cClient = sheets(cClientS), it doesn't set the sheet for the worksheet variable.  I've been searching Google for hours and I can't seem to figure out what I'm doing wrong.
 
     
    