+ Reply to Thread
Results 1 to 4 of 4

Select and copy range based on value "Closing Balance"

  1. #1
    Registered User
    Join Date
    06-14-2017
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    1

    Select and copy range based on value "Closing Balance"

    I am trying to do a few things with this code, some of which I have sorted out already. My issue is trying to select a range, and having it end on a specific cell within the table I want to select.

    Step 1 - find letter "A" in column E, then go down 6 cells and left 1 to "Opening Balance" in column D (it will always be 6 down, 1 left to go from this value "A" to "Opening Balance").

    Step 2- once at "Opening Balance" in column D, I need to select the entire range down to "Closing Balance" (this range will differ depending on amount of info). In the example attached I need to select "A22:P30".

    Step 3 - copy and paste this data into another tab (I am fine with this code).

    Thanks for any input!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,000

    Re: Select and copy range based on value "Closing Balance"

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    10-31-2014
    Location
    toronto
    MS-Off Ver
    Professional Plus 2013
    Posts
    3

    Re: Select and copy range based on value "Closing Balance"

    You are amazing. Is there any way to get this to select the table from cell A instead of D?

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,000

    Re: Select and copy range based on value "Closing Balance"

    Look for "A" in column E:
    With Range("E:E")
    Set Opening = .Find(What:="A")
    End With


    Use offset to re-initialize OPENING to the cell down 6 rows and LEFT one column to column D:

    Set Opening = Opening.Offset(6, -1)

    With Range("D:D")
    Set Closing = .Find(What:="Closing Balance")
    End With


    Since you now have the location of the "Closing Balance" you can reset OPENING to reference column A of the row where Opening Balance is found, by using OFFSET again:

    Set Opening = Opening.Offset(ColumnOffset:=-3)

    But now you must resize the range from 13 columns to 15 (i.e., A:P)

    Range(Opening.Address, Closing.Address).Resize(columnsize:=15).Select
    Last edited by protonLeah; 06-14-2017 at 11:59 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Excel VBA to Activate/Select Cell based on "Found" Range
    By fhill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2016, 04:37 AM
  2. Make 'ActiveSheet.Range("C5:N100").Select' - select a dynamic range of cells
    By white_ross in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-13-2016, 10:00 AM
  3. [SOLVED] Copy cells from range "C3" to "F3" with loop and blank field
    By masterm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-16-2015, 01:03 PM
  4. Replies: 6
    Last Post: 12-08-2014, 01:28 AM
  5. [SOLVED] Replace all BLANK cells in column with header title "Balance" to "0"
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2014, 09:25 AM
  6. Replies: 3
    Last Post: 04-14-2013, 11:53 PM
  7. Range all sheets to cell "A1" before closing file
    By brunces in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2005, 03:33 PM

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