I am trying to convert String of cells position into range
Dim closeAfcc As Integer
Dim restCases As Integer
Dim AFCCRange As String
Dim rng As Range
i = 2
closeAfcc = 0
restCases = 0
Do
If Sheet1.Cells(i, 6) = "Closed-AFCC" Then
closeAfcc = closeAfcc + 1
AFCCRange = AFCCRange + "sheet1!K" & i & ","
Else
restCases = restCases + 1
End If
i = i + 1
Loop Until Sheet1.Cells(i, 6) = ""
AFCCRange = Left(AFCCRange, Len(AFCCRange) - 1)
Set rng = Range(AFCCRange)
I got Error 1004
my string result is
AFCCRange= sheet1!K2,sheet1!K3,sheet1!K4,sheet1!K6,sheet1!K7,sheet1!K8,sheet1!K9,sheet1!K10,sheet1!K11,sheet1!K12
Thanks