Consulting

Results 1 to 4 of 4

Thread: Problem with Range Box

  1. #1

    Problem with Range Box

    Hi,

    What's wrong with following codes?
    The inputbox doesn't allow me to highlight any cells on the spreadsheet,
    so I have to type in the range e.g. C6:C10 myself..

    Please advise, thanks.

    Sub Delete_PrefixCharacters()
    Dim wsActive As Worksheet
    Dim rng As Range
    Dim R As Range
    Application.ScreenUpdating = False
    Set rng = Application.InputBox("Select Range", Type:=8)
    Set wsActive = ActiveSheet
    With wsActive
    ' Loop through all used cells in the active worksheet.
    For Each R In rng
    ' If a prefix character exists, delete it.
    If R.PrefixCharacter <> "" Then
    R.Value = R.Value
    End If
    Next
    End With
    Application.ScreenUpdating = True
    End Sub

  2. #2
    VBAX Tutor Philcjr's Avatar
    Joined
    Jul 2005
    Location
    Bedminster, NJ
    Posts
    208
    Location
    comment this line of code... see if this helps


    'Application.ScreenUpdating = False


    This will allow you to select a range

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Philcjr
    comment this line of code... see if this helps

    'Application.ScreenUpdating = False
    This will allow you to select a range
    Don't do that, just re-order


    Set rng = Application.InputBox("Select Range", Type:=8)
    Application.ScreenUpdating = False
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    THANK YOU!

Posting Permissions

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