+ Reply to Thread
Results 1 to 2 of 2

Variable Last Row Definition

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    1

    Variable Last Row Definition

    Hello,

    I'm kind of a noob to VBA, but I am trying to write a macro using a variable last row definition (lngLastRow). I've done this before and have had success, but this time the code is not defining the correct last row. Here are the important specifics (as I see them):

    In a worksheet, I am subtotalling data by a column heading. From there I am copying and pasting visible cells in the same worksheet to the right of the data. Then, I am removing the subtotals and deleting the columns that held the original data. Finally, I am using the lngLastRow dimension to define the last row of data. The result is that the last row is being defined by the number of rows in the original table (before I subtotalled the data) instead of the pasted visible rows.

    How do I properly define the range I am looking for?

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    05-14-2013
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2003/2010
    Posts
    17

    Re: Variable Last Row Definition

    You have two options that I can see...

    First move your Dim lngLstRow to after the Paste or just create an array:

    Please Login or Register  to view this content.
    Or how ever you are using lngLstRow, you just need to recount after you paste.

+ 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] Variable definition problem
    By Orestees in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-17-2012, 02:46 PM
  2. How to insert a variable or formula in a cell definition
    By Daniel Sher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-04-2008, 03:39 PM
  3. OleoObject name variable definition
    By mmf in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-05-2008, 05:09 PM
  4. Excel question with variable definition
    By Yong Kim in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2005, 02:06 PM
  5. The definition of....
    By Ursula in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-16-2005, 12:14 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