+ Reply to Thread
Results 1 to 8 of 8

Increase number of rows

  1. #1
    Registered User
    Join Date
    07-29-2008
    Location
    Washington St
    Posts
    13

    Increase number of rows

    As you can see in the attached file, I have two worksheets. The first one is an project estimating sheet. The second is a comparative sheet for evaluating the actual profit of a project. In the "Budget" sheet I may add or delete rows depending on the amount of product required for a project. The "Design" and "Expenses" sections never change.

    My end goal is to create a macro that would move specific information from "Budget" to "Job Cost Tracking". The first step in this process is the only part I'm not sure of how to do. I would like the number of rows of both sheets to match. My first thought was to write a function that counts the number of rows then apply that number into a macro.

    First of all, is that the most efficient approach? If not, what would you recommend? Secondly, if it is a good approach, how do you write a Count formula to count the number of rows between "Standard" and "Sub Contracted". I know how to Count if it's between dates, numbers, etc., but is there a way to Count between words?

    Thanks for the help!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Increase number of rows

    Here is one way to establish a row count.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-29-2008
    Location
    Washington St
    Posts
    13

    Re: Increase number of rows

    Can I apply that code as part of an insert or autofill? In other words, rather than the code just telling me how many rows I have, can it use that number to regulate an AutoFill macro?

    Thanks!

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Increase number of rows

    I'm sure it can be done. But you need to explain further what you need your requirements are.

  5. #5
    Registered User
    Join Date
    07-29-2008
    Location
    Washington St
    Posts
    13

    Re: Increase number of rows

    Part of the code that you suggested includes...

    Do Until ActiveCell.Value = "Standard"
    ActiveCell.Offset(1).Select
    Loop
    Do Until ActiveCell.Value = "Sub Contracted"

    Is there a way to apply that into a Range such that the AutoFill would go from the cell below Standard and stop at the cell above Sub Contracted.

    My attempt at this failed miserably. The following macro keeps crashing excel.

    Sub AutoFillTest()
    Range("A6").Select
    Do Until ActiveCell.Value = "Standard"
    ActiveCell.Offset(1).Select
    Loop
    Selection.AutoFill Destination:=Range("A6"), Type:=xlFillDefault
    Do Until ActiveCell.Value = "Sub Contracted"
    Loop
    End Sub

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Increase number of rows

    Not sure this is what you want?

    Please Login or Register  to view this content.
    This fills the Range("A6") value between "Standard" and "Sub Contracted"

  7. #7
    Registered User
    Join Date
    07-29-2008
    Location
    Washington St
    Posts
    13

    Re: Increase number of rows

    That's close, but I have a formula in ("A6") and would like that formula to AutoFill. I'm certainly not a VBA expert but if I'm understanding your code correctly, can we just change the 10th line (ActiveCell.Value = Range("A6").Value) to something like ActiveCell.AutoFill Destination:=("J6"), Type:=FillDefault ?

    I have tried this but I'm getting a run-time error, "AutoFill method of Range class failed".

    Also, for some reason the Offset isn't moving the ActiveCell one row down from "Standard". In fact as I change the value it is still not moving meaning that the contents of ("A6") are replacing "Standard".

    Thanks for your help on this

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Increase number of rows

    Sorry for the late reply. I was offline for a few days maybe:

    Please Login or Register  to view this content.

+ 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. Getting a value to increase or decrease number or rows...
    By Eggert in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-06-2009, 12:49 PM
  2. [SOLVED] The increase number of rows in Excel
    By wise_man in forum Excel General
    Replies: 10
    Last Post: 07-11-2006, 01:35 PM
  3. [SOLVED] Increase the maximum number of rows
    By Mortego in forum Excel General
    Replies: 3
    Last Post: 06-29-2006, 09:10 AM
  4. Replies: 3
    Last Post: 10-19-2005, 01:10 PM
  5. Replies: 2
    Last Post: 03-18-2005, 04:06 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