Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Slow Procedure

  1. #1
    Guest

    Default

    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


  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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



Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •