+ Reply to Thread
Results 1 to 3 of 3

Finding dynamic range

Hybrid View

hardik.r.shah Finding dynamic range 07-03-2012, 12:59 AM
nilem Re: Finding dynamic range 07-03-2012, 01:12 AM
hardik.r.shah Re: Finding dynamic range 07-03-2012, 01:30 AM
  1. #1
    Registered User
    Join Date
    07-02-2012
    Location
    mumbai
    MS-Off Ver
    Excel 2007
    Posts
    6

    Finding dynamic range

    Please refer the attachment for my requirement.

    As per attached sheet,
    I want to write a code in vba which will give me the range starting with the cell having value = "securityId" whose position is F4 and range will end with cell which is the intersaction of last row and last column. , in my case its J10. simply I want the range F4:J10. I want to write a code which can find this range dynamically , no matter where the securityId is located.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Finding dynamic range

    maybe so
    Sub ert()
    Dim rng As Range
    Set rng = ActiveSheet.UsedRange.Find("securityId", lookat:=xlWhole)
    If Not rng Is Nothing Then
        rng.CurrentRegion.Select
        MsgBox rng.CurrentRegion.Address
    Else
        MsgBox "Not found securityId"
    End If
    End Sub

  3. #3
    Registered User
    Join Date
    07-02-2012
    Location
    mumbai
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Finding dynamic range

    Thanks Nilem.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1