Consulting

Results 1 to 4 of 4

Thread: Autopopulating columns until one column reaches a certain value, then stopping

  1. #1

    Autopopulating columns until one column reaches a certain value, then stopping

    Hi,

    I am a new VBA user, and I have run into a problem with my current project. I have 4 columns, 3 containing simple formulas.
    In Excel, I would simply select these columns, and drag them down until the "Mortgage Balance" equals zero. I would then drag and select the data, so I could copy it.

    What I want to do in VBA is to have a macro that automatically selects the first few rows and then drags the columns down so that they autopopulate until the "Mortgage Balance" column equals zero, and then stop. The formulas have different inputs, so the number of cells it takes for the "Mortgage Balance" to equal zero will vary. I would then like VBA to select all of the data so that I can then copy and paste it into another sheet. I wish I could post some code that I have already, but I am afraid I have nothing as I am so new to this.

    I have a attached a simple picture of my worksheet for reference.

    VBA Example 1.jpg

    Any insight or advice is greatly appreciated!

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    welcome to the forum.

    rather than posting the SS of the sheet, post your workbook pls...
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    Quote Originally Posted by mancubus View Post
    welcome to the forum.

    rather than posting the SS of the sheet, post your workbook pls...
    My apologies, please find it attached. Mortgage Calculator Example.xlsx

  4. #4
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    this is what you need:
    http://www.vbaexpress.com/kb/getarticle.php?kb_id=833

    download and unzip the attachment.
    open the unzipped file and save it as xlsm.
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Posting Permissions

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