Prevost
Board Regular
- Joined
- Jan 23, 2014
- Messages
- 198
Hi There. I am running the code shown below and it is going incredibly slow. When I manually run the code (pressing F8) I notice there is a long pause when the Cell length = 6 between the lines ' Cell = MyLeft & ".00" ' and the 'End If' statement. Can anyone see why? Does the size of the file have an impact on how quickly the code runs (this file is 34 MB)? Or how many lines of code are in a module?
I am just cleaning up/formatting data in a spreadsheet and I have written small macros like this before and never had any issues.
Thanks.
I am just cleaning up/formatting data in a spreadsheet and I have written small macros like this before and never had any issues.
Thanks.
Code:
Sub FormatUWFrameWindingData()
Dim MyLeft, MyRight
Dim Cell As Range
For Each Cell In Selection
If Len(Cell) = 6 Then
MyLeft = Cell
Cell = MyLeft & ".00"
ElseIf Len(Cell) = 8 Then
MyLeft = Left(Cell, 6)
MyRight = Mid(Cell, 7, 2)
Cell = MyLeft & "." & MyRight
End If
Next Cell
End Sub
Last edited: