+ Reply to Thread
Results 1 to 13 of 13

VBA to copy a value until new value in Active column

  1. #1
    Forum Contributor
    Join Date
    05-24-2020
    Location
    London
    MS-Off Ver
    Office 365 pro
    Posts
    177

    VBA to copy a value until new value in Active column

    Hello, everyone,
    i have a little neat code that copies the values in one column down until the next one is worth.
    Unfortunately the code only works if you define the column in the code.

    Can someone adapt the code to take the column of the activated cell.

    So 'Activecell'.

    Here's the code:

    Please Login or Register  to view this content.

    Thank you very much.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,380

    Re: VBA to copy a value until new value in Active column

    Untested, but it would probably be something like:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    05-24-2020
    Location
    London
    MS-Off Ver
    Office 365 pro
    Posts
    177

    Re: VBA to copy a value until new value in Active column

    Thanks for the answer
    Creates a
    #BEZUG
    Error in the empty cells.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,380

    Re: VBA to copy a value until new value in Active column

    What's #BEZUG?

    Post a sample workbook.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: VBA to copy a value until new value in Active column

    How about
    Please Login or Register  to view this content.
    If the cell in row1 is blank, every blank cell is filled with #REF.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: VBA to copy a value until new value in Active column

    Quote Originally Posted by TMS View Post
    What's #BEZUG?
    Bet for a german version …

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,380

    Re: VBA to copy a value until new value in Active column

    Bet for a german version …
    I guessed that may be the case, but I still don't know what the error is in English

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: VBA to copy a value until new value in Active column

    It's #REF!, possibly because row 1 in the column was blank.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,380

    Re: VBA to copy a value until new value in Active column

    Variations on a theme. The second two cater for row 1 being blank.

    Please Login or Register  to view this content.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,380

    Re: VBA to copy a value until new value in Active column

    Bet for a german version …
    Interesting that the OP is using a German version of Excel though the location is London. Confusing

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: VBA to copy a value until new value in Active column


    Not as it's a well known financial place, like here in Paris where I have seen English version like Spanish and other local ones …

  12. #12
    Forum Contributor
    Join Date
    05-24-2020
    Location
    London
    MS-Off Ver
    Office 365 pro
    Posts
    177

    Re: VBA to copy a value until new value in Active column

    Thank you very much y'all.
    It was a very great help.
    And yes it is a german version.
    Got a PC Tablet from a friend and am too lazy to install new office.

    Again guys thanks for the great help.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,380

    Re: VBA to copy a value until new value in Active column

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Copy Selected active cells down to right column
    By Grahamfeeley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2018, 09:07 PM
  2. Replies: 4
    Last Post: 07-03-2015, 04:27 AM
  3. [SOLVED] UNSOLVED - Identify highlighted cells in column, copy cell value to column B of active row
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-16-2014, 04:42 AM
  4. [SOLVED] Copy active cells from one column as a sequence in another cell
    By adihad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2013, 03:59 AM
  5. Search for Value in Closed Workbook and copy Column to Active Sheet Column BE
    By Winon in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-19-2011, 12:57 PM
  6. Macro to copy column from multiple workbooks and transpose in active book
    By kishen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-04-2011, 05:48 AM
  7. Marco to copy from active cell to top of column
    By Balthasar G in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2006, 08:29 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