![]() |
Excel vba script extremely slow
Hello I have strange problem with this vba script Values in cells are numeric or string like 1, a2, aa, 3 etc. Each loop takes ~10sec on 2.5 GHz Pentium Code ------------------- Dim column As Integer Dim row As Integer Dim value As String Application.ScreenUpdating = False For column = 4 To 44 value = Cells(row,column ).Value MsgBox (value) Next sarake Application.ScreenUpdating = True ------------------- Any suggestions on how to make it run faster ? Nevermind I got it workin :D stupid m -- persenen ----------------------------------------------------------------------- persenena's Profile: http://www.excelforum.com/member.php...fo&userid=2491 View this thread: http://www.excelforum.com/showthread.php?threadid=38448 |
Excel vba script extremely slow
Apart from the fact that the For ... Next loop seems ill-constructed and ro
is not set, surely, it is the Msgbox that makes it slow, haviun g to respond each time? The data processed is sm all so it should be quick in essence. Also, not a good idea to have variables called row, column, value. Try this Dim iCol As Integer Dim iRow As Integer Dim myValue As String Application.ScreenUpdating = False iRow = 1 For iCol = 4 To 44 myValue = myValue = Cells(iRow,iCol).Value & vbNewline Next iCol Application.ScreenUpdating = True MsgBox (myValue) -- HTH Bob Phillips "persenena" wrote in message ... Hello I have strange problem with this vba script Values in cells are numeric or string like 1, a2, aa, 3 etc. Each loop takes ~10sec on 2.5 GHz Pentium Code: -------------------- Dim column As Integer Dim row As Integer Dim value As String Application.ScreenUpdating = False For column = 4 To 44 value = Cells(row,column ).Value MsgBox (value) Next sarake Application.ScreenUpdating = True -------------------- Any suggestions on how to make it run faster ? Nevermind I got it workin :D stupid me -- persenena ------------------------------------------------------------------------ persenena's Profile: http://www.excelforum.com/member.php...o&userid=24910 View this thread: http://www.excelforum.com/showthread...hreadid=384484 |
Excel vba script extremely slow
Sorry typo.
BTW, it was too fast to clock on my 2Mhz system Dim iCol As Integer Dim iRow As Integer Dim myValue As String Application.ScreenUpdating = False iRow = 1 For iCol = 4 To 44 myValue = myValue & Cells(iRow, iCol).Value & vbNewLine Next iCol Application.ScreenUpdating = True MsgBox (myValue) -- HTH Bob Phillips "persenena" wrote in message ... Hello I have strange problem with this vba script Values in cells are numeric or string like 1, a2, aa, 3 etc. Each loop takes ~10sec on 2.5 GHz Pentium Code: -------------------- Dim column As Integer Dim row As Integer Dim value As String Application.ScreenUpdating = False For column = 4 To 44 value = Cells(row,column ).Value MsgBox (value) Next sarake Application.ScreenUpdating = True -------------------- Any suggestions on how to make it run faster ? Nevermind I got it workin :D stupid me -- persenena ------------------------------------------------------------------------ persenena's Profile: http://www.excelforum.com/member.php...o&userid=24910 View this thread: http://www.excelforum.com/showthread...hreadid=384484 |
All times are GMT +1. The time now is 01:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com