I know there are several posts about this problem on this forum, but my problem is more confusing because i'm not even dealing with a significant amount of data. All I am trying to do is have a macro dynamically determine the # of rows of data for 1 worksheet and name a range based on that. The current data range only has 6 columns (A:F, it stays static) and 81 rows. Here is the code:
Sub Dyno_Range1()
Dim LastRow As Long
LastRow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
Sheet1.Range("A7:F" & LastRow).Name = "Data"
End Sub
This code actually works in that the range gets named correctly, but at the "End Sub" it brings back an "Out of Memory" error. I don't get it because LastRow = "81". How can this possibly use up enough memory to cause an Out of Memory error?
Thanks for your help Excel experts!
Eric
Sub Dyno_Range1()
Dim LastRow As Long
LastRow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
Sheet1.Range("A7:F" & LastRow).Name = "Data"
End Sub
This code actually works in that the range gets named correctly, but at the "End Sub" it brings back an "Out of Memory" error. I don't get it because LastRow = "81". How can this possibly use up enough memory to cause an Out of Memory error?
Thanks for your help Excel experts!
Eric