+ Reply to Thread
Results 1 to 6 of 6

Visual Basic: looping a copy / paste and transpose function

  1. #1
    Registered User
    Join Date
    06-08-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Visual Basic: looping a copy / paste and transpose function

    Hello to everybody,

    I have an excel sheet in which the diagonal cells (B3, C4, D5, E6 ecc ecc) are locked.

    I want to copy from C3 to M3, than paste (values) and transpose on from cell B4 to B12.

    I recorded a macro that does this
    Please Login or Register  to view this content.
    but I am not able to programme the code in order to execute a second action starting this time from range "D4:M3" and paste/transpose to cell C5.

    I would like to loop this action untill cell M11 and copy paste only that last single cell in L14 (this is an example, I have to this for hundreds of rows actually....)

    I tried some loop commands but the action goes on infinitely without skipping the diagonal cells and moeover without stopping.

    Thank you it would be great to receive a visual basic code!
    Last edited by arlu1201; 06-08-2012 at 02:46 PM. Reason: Use code tags.

  2. #2
    Forum Contributor
    Join Date
    04-12-2012
    Location
    MD, England
    MS-Off Ver
    Excel 2003
    Posts
    142

    Re: Visual Basic: looping a copy / paste and transpose function

    Hi Frey

    Try this.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-12-2012
    Location
    MD, England
    MS-Off Ver
    Excel 2003
    Posts
    142

    Re: Visual Basic: looping a copy / paste and transpose function

    Frey

    You mentioned the cells were locked which I assume you mean protected?
    This will take care of that.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-08-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Visual Basic: looping a copy / paste and transpose function

    GREAT! Thank you! The first code you sent me works perfectly!

  5. #5
    Forum Contributor
    Join Date
    04-12-2012
    Location
    MD, England
    MS-Off Ver
    Excel 2003
    Posts
    142

    Re: Visual Basic: looping a copy / paste and transpose function

    Frey

    The first code you sent me works perfectly!
    That implies the second does not. I'm a bit puzzled. There is little difference excepting the Unprotect, Protect and a password of your choice. So the second code should work as well.
    If the second does not work have you substituted your own password where appropriate?
    Are you clear about what 'locked' means i.e. 'not able to be modified'? A cell is only truly locked when the wsheet is Protected.

  6. #6
    Registered User
    Join Date
    06-08-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Visual Basic: looping a copy / paste and transpose function

    Hello gmk,

    actually you are right and you saw my error :-) I did not put my password in the code! Thanks again for the help, it works!

    Kind regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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