+ Reply to Thread
Results 1 to 7 of 7

Macro Help Required - Run script until no more data in column. Possible loop needed?

  1. #1
    Registered User
    Join Date
    02-28-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    49

    Question Macro Help Required - Run script until no more data in column. Possible loop needed?

    Hi,

    I have a simple Button that when pressed will run the following command:

    Please Login or Register  to view this content.
    The problem I am facing is, the list is column A will vary in length ever day, therfore I do not want to have to edit my code daily. Can someone help me re-code this so it stops when it gets to the last cell that contains data in column A. I know I can simple change Range("B:B") but I am then left with date that needs to be deleted.
    Any help would be much appreciated.

    Dave
    Last edited by djm601; 02-28-2012 at 07:59 AM. Reason: my question was answered

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro Help Required - Run script until no more data in column. Possible loop need

    What is your macro trying to achieve?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    02-28-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: Macro Help Required - Run script until no more data in column. Possible loop need

    Hi thanks,

    I have a list of Order Numbers in column A

    BDG-00000001
    BDG-00000002
    BDG-00000003

    When i press the button, I would like it to simply add the following to the ID numbers in coulmn B as a seperate list or even alter column A.

    'BDG-00000001',
    'BDG-00000002',
    'BDG-00000003',

    I have achieved this by recording a macro however the list of ID numbners that will be in the spreadsheet will very, e.g. today there are 50 but tomorrow there could be 100

    Can you alter my original marco so that the script is not fixed to Range("B2:B53") as shown in my example, and it will apply this formula to all cells in the column

    Hope this makes sense,

    cheers,

    Dave

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro Help Required - Run script until no more data in column. Possible loop need

    Please take a moment to read the forum rules and amend your original post to include code tags.

    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Select your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button).
    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro Help Required - Run script until no more data in column. Possible loop need

    Sorry i cant reply to you till you put the code tags.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro Help Required - Run script until no more data in column. Possible loop need

    All you need is this code
    Please Login or Register  to view this content.
    You can then include the code to copy pastespecial values if required.

  7. #7
    Registered User
    Join Date
    02-28-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    49

    Thumbs up Re: Macro Help Required - Run script until no more data in column. Possible loop need

    Excellent! Thank you, this was bugging me for an hour!

    Your code worked fist time, cheers.

    Dave

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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