निम्न स्क्रिप्ट छोटे डेटा सेट (30k पंक्तियों से कम या उससे कम) पर काम करती है, लेकिन चयनित श्रेणी में प्रत्येक सेल के लिए "#VALUE" त्रुटियों का परिणाम होता है जब सीमा उस से बड़ी होती है।वीबीए और एक्सेल: मेरे डेटा स्क्रिप्ट का परिणाम #VALUE में बड़े डेटा सेट पर क्यों होता है?
Dim FirstCell As Range, LastCell As Range, MyRange As Range
Set LastCell = Cells(Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row, _
Cells.Find(What:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Column)
Set FirstCell = Cells(Cells.Find(What:="*", After:=LastCell, SearchOrder:=xlRows, _
SearchDirection:=xlNext, LookIn:=xlValues).Row, _
Cells.Find(What:="*", After:=LastCell, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, LookIn:=xlValues).Column)
Set MyRange = Range(FirstCell, LastCell)
MyRange.Select
If MyRange Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
With Selection
.Value = Evaluate("if(row(" & .Address & "),clean(trim(" & .Address & ")))")
End With
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
MsgBox "Finished trimming " & vbCrLf & "excess spaces", 64
इस कोड के साथ आप कितने सेल बदल रहे हैं? मैंने अभी इसे ~ 1.7 मिलियन सेल्स पर परीक्षण किया है और मुझे अपने अभ्यास दस्तावेज़ पर – TMH8885
8,106,860 कोशिकाओं में कोई त्रुटि नहीं मिली है। यह 161,363 पंक्तियां है। –
ऐसा लगता है कि यह लगभग 70k पंक्तियों तक काम करता है। उस से बहुत अधिक, यह चयनित श्रेणी में प्रत्येक सेल का मान #VALUE पर सेट करता है। –