Results 1 to 12 of 12

Thread: find with xlprevious not working

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    VBAX Expert
    Joined
    Sep 2010
    Posts
    604
    Location
    After seeing your additional description of the issue, I'm experiencing the same problem.. The multi-column merged cells seem to be handled fine, but the multi-row merged cells get skipped.

    If the users never change the sheet layout, or which cells have data, you could use select case for every cell address.

    I put together the sample code below to demonstrate. (admittedly long winded and a lot of effort needed to code every address)
    (sampleworkbook attached) -- coded only for cells H18 to A13
    [vba]Sub CellPrev()
    Option Explicit
    ' this covers only Range("A13:H18")
    If ActiveCell.Column = 1 Then
    ActiveCell.Offset(0, 1).Select
    End If

    If ActiveCell.Column >= 9 Then
    ActiveCell.Offset(0, 9 - ActiveCell.Column).Select
    End If

    Select Case ActiveCell.Address

    Case ("$A$16"), ("$G$19")
    ActiveCell.Offset(-1, -2).Select

    Case ("$A$17")
    Range("H17").Select

    Case ("$B$13")
    Range("H13").Select

    Case ("$B$17")
    Range("H17").Select

    Case ("$H$17")
    Range("E15").Select

    Case ("$A$15")
    Range("H16").Select

    Case ("$B$15")
    Range("H16").Select

    Case ("$F$18"), ("$G$18"), ("$H$18")
    Range("E17").Select

    Case ("$H$15"), ("$H$16")
    ActiveCell.Offset(-1, 0).Select

    Case ("$F$13"), ("$G$13"), ("$F$14"), ("$G$14")
    Range("E13").Select

    Case ("$F$15"), ("$G$15"), ("$F$16"), ("$G$16")
    Range("E15").Select

    Case ("$F$17"), ("$G$17"), ("$F$18"), ("$G$18")
    Range("E17").Select

    Case ("$H$14")
    Range("E13").Select

    Case ("$H$13")
    Range("H11").Select

    '... and so on

    Case Else
    ActiveCell.Offset(0, -1).Select

    End Select

    End Sub[/vba]
    Attached Files Attached Files
    Last edited by frank_m; 07-07-2011 at 07:13 PM. Reason: tidied up some of my comments.

Posting Permissions

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