Slow Procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Guest
Hi all,
I have this code to grab the first 3 chars from a line. Problem is.. whenever its running, the cursor quickly switches from the normal arrow to hourglass, giving it a flickering effect. Any ways to eliminate that?? Also, I have already set screenUpdating = False.


Sub GetSVCodeFromLine16()

Dim objLastCell As Object, cell As Object, strSVCode As String

Set objLastCell = RealLastCell(Application.ActiveSheet)

For Each cell In Range("S2", objLastCell)
strSVCode = Left(Trim(cell.Value), 3)
cell.Offset(rowOffset:=0, columnOffset:=1).FormulaR1C1 = UCase(strSVCode)
Next cell

End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
No too sure if your last cell is in Column "S", but if so use:

Sub GetSVCodeFromLine16()

Dim objLastCell As Range, cell As Range

Range("S2", Range("S65536").End(xlUp)) _
.FormulaR1C1 = "=UPPER(LEFT(TRIM(RC[-1]),3))"

Range("S2", Range("S65536").End(xlUp)) = _
Range("S2", Range("S65536").End(xlUp)).Value

End Sub

Loops ae generally very slow in comparison.

Not to sure what method you are using to find the real last cell either but the safets way is via the Find Method. I have many examples here: http://www.ozgrid.com/VBA/ExcelRanges.htm
 
Upvote 0

Forum statistics

Threads
1,223,362
Messages
6,171,640
Members
452,413
Latest member
N3edHelp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top