I have been creating named ranges ahead of time in the past for Dynamic Ranges, that I need to plot using:

=OFFSET(Response_Time_Data!$C$2,0,0,COUNTA($C:$C))

I recently began work on some new data that ran over 32000 rows and I got an error. Since I don't know how many rows I will have, I can't create the required named ranges ahead of time. So I was thinking that there must be a way to count the rows, divide by 32000, so I'll know how many named ranges will be required. Each grouping of 32000 will have it's own named range. Each time a new set of data that are imported would require a new set of named ranges, so the old named ranges will have to be deleted. I developed this bit of code to come up with an incrementing variable for the 32000 row groupings:

Sub Tool_Count_Rows()
Dim resptimcontX(50) As Integer
numrows = Range("C2", Range("C" & Rows.count).End(xlUp)).Rows.count
i = 1
Do Until (numrows - 32000) < 0
If numrows < 32000 Then
resptimcontX(i) = numrows
Else
numrows = numrows - 32000
resptimcontX(i) = 32000
i = i + 1
End If
Loop
resptimcontX(i) = numrows
End Sub

The problem I have is twofold: the first is that excel doesn't like my variable use and returns a #NAME# error for the formula below. Second, I am not clear on how to create a named range using VBA and delete it when I finished with the current set of data.

=OFFSET(Response_Time_Data!$C$2,0,0,resptimcontX(i))

Steve