+ Reply to Thread
Results 1 to 5 of 5

Help Selecting Cells with VBA When Columns Contain Different Amounts of Records

  1. #1
    Forum Contributor
    Join Date
    07-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    139

    Help Selecting Cells with VBA When Columns Contain Different Amounts of Records

    I have a sheet that uses 8 columns, A-H. Columns A-E contains time tracking info that I bring in from a different sheet. Columns F-H contain formulas. I am only bring over Columns A-E so there are times where Columns A-E may have say 100 rows, but Columns F-H have 80. What I am trying to do in VBA is to copy the last row of formulas in columns F-H and paste special formulas into the last 20 rows (or however many there may be at the time).

    I have the following code which selects the last cell in row F that contains the formula just fine (without the :H in the range line), however as soon as I try to add the :H part I get an error Method range of object global failed. I am missing something small I know this, but nor sure what. Any help out there gurus

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,110

    Re: Help Selecting Cells with VBA When Columns Contain Different Amounts of Records

    Try

    Please Login or Register  to view this content.
    Never use Merged Cells in Excel

  3. #3
    Forum Contributor
    Join Date
    07-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Help Selecting Cells with VBA When Columns Contain Different Amounts of Records

    That selects the entire sheet from the last row in H to A1, I only want to copy F-H last row with data, in my case currently I have data in range A4-E124 and in Columns F4-H111, what I want is to copy F111 - H111 and paste the formulas into F112 - H112. These row numbers will differ every time I run my other procedure which brings data into column A-E so the last row will always be different each time I run this. Hence the need to use lastrow variable

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,110

    Re: Help Selecting Cells with VBA When Columns Contain Different Amounts of Records

    In that case:

    Please Login or Register  to view this content.
    or simplier

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Help Selecting Cells with VBA When Columns Contain Different Amounts of Records

    OFFSET.....BRILIANT thank you much, exactly what I needed.

+ 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. Dividing dollar amounts unevenly into varying numbers of cells/columns
    By Busterbrown in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-26-2014, 01:26 PM
  2. Replies: 1
    Last Post: 05-10-2012, 10:42 AM
  3. Selecting amounts and sum them from a column
    By jullia_nana in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-20-2011, 06:30 AM
  4. Replies: 2
    Last Post: 12-10-2009, 01:20 PM
  5. [SOLVED] Selecting amounts to display based on quantity
    By Ray Ash in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2005, 07:05 PM

Tags for this Thread

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