+ Reply to Thread
Results 1 to 6 of 6

Copy some specific range in first empty row with macros

  1. #1
    Registered User
    Join Date
    01-21-2015
    Location
    Stuttgart, Germany
    MS-Off Ver
    2013
    Posts
    3

    Copy some specific range in first empty row with macros

    Hey there, I`m quite new here and in programming macros in excel either, yet I managed to programm some macros already. But now I stuck. I`m not a native english speaker, so I hope I can communicate my problem in a comprehensive way.
    My spreadsheet include statistics about company`s. For example, column 1: Date, column 2: Stock price at this date, column 3: market capitalization at this date and so on. From column Q on the same date is listed for company 2, from column AG on for company 3 and so forth. Every column has 89 rows. Now I want this data to be listed one below the other. (the companies one below the other) Specifically, I want to leave one row empty under company 1, and then list the Data for company 2 starting in row 91. So I have to copy for company 2 date from columns Q-AF and from rows 1-89 and paste this in cell A91. I got over 250 companies in my sheet so I can`t execute that manually. I also tried a bit with macros and this is what I got (and what obviously didn`t work):

    Sub neu()

    '** Determination of the last column in row 1
    ls = Cells(1, Columns.Count).End(xlToLeft).Columns.Column

    Dim s As Integer
    For s = ls To 1 Step -1 ' Backwards counting to column 1
    '** Ask, if the first row says: "Date"
    If Cells(1, s).Value = "Date" Then
    '** If it says, then should the following range be selected (from cell "date" on)
    Range(Cell(1, s), Cell(90, s & 17)).Select

    Selection.Copy
    '**Next it should be pasted into the second empty cell below the prevailing data (Don`t know how to model this)
    Range("A65536").End(xlUp).Paste
    End If

    Next s
    End Sub

    So, I hope this is somewhat understandable
    Best regards and thanks in advance
    Prinzboldi

  2. #2
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: Copy some specific range in first empty row with macros

    Hi, as of now i understand that you have data like Example Column 1 to Column 10 belongs to Company 1, Column 11 to Column 20 Belongs to Company 2, Column 21 to Column 30 Belongs to Company 3 and so on.........

    and you want the data to be in 1 Listing same like in Transpose way... as Column1 to Column 10 is Company 1..
    and after last row leave 1 row and again Column1 to Column10 is company 2.................................. Right ?

    Just clarify are the number of Columns are same for each Company ??, Like Company 1 columns , company 2 , Number of columns are same ???

  3. #3
    Registered User
    Join Date
    01-21-2015
    Location
    Stuttgart, Germany
    MS-Off Ver
    2013
    Posts
    3

    Re: Copy some specific range in first empty row with macros

    Hi,
    Yeah you got it, that`s what I want... And yes, the Number of columns is the same for each company

  4. #4
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: Copy some specific range in first empty row with macros

    This should do your job... you just need to put the correct number of columns value in the for loop below

    Instead of 3 put the actual number of columns for each company
    in this line of code
    Please Login or Register  to view this content.
    and instead of 2 put the actual number of columns -1 for each company (if Columns are 10 then put 9)
    in this line of code
    Please Login or Register  to view this content.
    Press Alt +F11 and create a module and paste below code... and run....

    Please Login or Register  to view this content.
    Last edited by naveenmarapaka; 01-21-2015 at 09:40 AM.

  5. #5
    Registered User
    Join Date
    01-21-2015
    Location
    Stuttgart, Germany
    MS-Off Ver
    2013
    Posts
    3

    Re: Copy some specific range in first empty row with macros

    Hey that works perfectly, thanks a lot =)

  6. #6
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: Copy some specific range in first empty row with macros

    Glad it helped you


    1.Click on Star(Reputation) if you think someone helped you....
    2. Mark the Thread as Solved using Thread tools....

+ 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. [SOLVED] Find next empty cell (Row)within a specific range in column A
    By JRidge in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2014, 05:39 AM
  2. Macros on how to copy, paste, edit and remove empty cells
    By razor_raef in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-20-2014, 01:30 AM
  3. [SOLVED] Select the last empty cell of the range specific
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2013, 09:48 AM
  4. Copy and paste specific range to date specific range in alternate sheet
    By alanalmarza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2013, 08:29 AM
  5. Find first empty row in a specific range
    By orlando_javier in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-23-2010, 03:09 PM

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