I have the following loop which currently only runs through 500 cells, but for some reason it seems to be taking FOREVER (30 seconds or more) to run. it seems like it should be a very fast process. I was wondering if someone might be able to help me optimize it or change it to make it faster. Here is the code:
SavedCells = ThisWorkbook.Sheets("DataSheet").Range("A65536").End(xlUp).Row
Counter = 1
Do Until Counter = SavedCells + 1
If Left(ThisWorkbook.Sheets("DataSheet").Range("A" & Counter).Value, 3) = "***" Or _
Left(ThisWorkbook.Sheets("DataSheet").Range("A" & Counter).Value, 3) = "" Then
Else
ThisWorkbook.Names.Add Name:=ThisWorkbook.Sheets("DataSheet").Range("A" & Counter).Value, _
RefersToR1C1:=ThisWorkbook.Sheets("DataSheet").Range("B" & Counter)
End If
Counter = Counter + 1
Loop
any help is appreciated, thanks!
SavedCells = ThisWorkbook.Sheets("DataSheet").Range("A65536").End(xlUp).Row
Counter = 1
Do Until Counter = SavedCells + 1
If Left(ThisWorkbook.Sheets("DataSheet").Range("A" & Counter).Value, 3) = "***" Or _
Left(ThisWorkbook.Sheets("DataSheet").Range("A" & Counter).Value, 3) = "" Then
Else
ThisWorkbook.Names.Add Name:=ThisWorkbook.Sheets("DataSheet").Range("A" & Counter).Value, _
RefersToR1C1:=ThisWorkbook.Sheets("DataSheet").Range("B" & Counter)
End If
Counter = Counter + 1
Loop
any help is appreciated, thanks!