Results 1 to 6 of 6

Ending a do loop with an exact cell or column.

Threaded View

  1. #1
    Registered User
    Join Date
    11-17-2014
    Location
    Moscow, ID USA
    MS-Off Ver
    2013
    Posts
    3

    Ending a do loop with an exact cell or column.

    Brand spanking new to this VBA fun and ran into a problem. I have been working on transferring data from a easy to enter spreadsheet to a better to look at the data spreadsheet. This part of the macro is working perfectly now, but it is written to copy at the next available blank, so if there are blanks in the middle of the data, it writes over into the wrong field. I have missed hand filling in these blanks with "-" a couple times and thought a quick "Prep" macro would do the trick for me.

    To my understanding, I have a code written out to start at a specific cell, go to the next available blank, and fill it with "-". The issue I am finding is I can't find a way to stop the loop at a specific cell. In the example below b51. Please take a look and let me know what I am doing wrong. Once again I am very new so please pretend you are explaining this to a moron...

    Thank you in advance!

    Sheets("Data Entry").Select
    Sheets("Data Entry").Range("d15").Select
    Do While ActiveCell < ("d51")
           If Sheets("Data Entry").Range("d15").Offset(1, 0) <> "" Then
        Sheets("Data Entry").Range("d15").End(xlDown).Select
        End If
    ActiveCell.Offset(1, 0).Select
    ActiveCell.Value = "-"
    Loop
    I based this off of what has been working great for me:

    i = 1
        Sheets("Biomass").Select
        Range("n2:t2").Select
        Selection.Copy
        Sheets("Biomass").Select
        Sheets("Biomass").Range("n1").Select
    Do While i < 181
           If Sheets("Biomass").Range("n2").Offset(1, 0) <> "" Then
        Sheets("Biomass").Range("n2").End(xlDown).Select
        End If
    ActiveCell.Offset(1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        i = i + 1
    Loop
    Last edited by Lankkari; 11-17-2014 at 11:51 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Do Until loop not ending
    By Dralky in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2014, 09:57 PM
  2. Do until Loop not ending
    By Alexm963 in forum Word Programming / VBA / Macros
    Replies: 6
    Last Post: 12-28-2012, 05:09 PM
  3. [SOLVED] ending a sub FOR loop in a main FOR loop
    By samkumar in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 09-27-2012, 05:35 AM
  4. Ending a Loop
    By kirsty in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-25-2010, 01:11 PM
  5. Never ending loop
    By Theodjinn in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-23-2008, 04:08 AM

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