+ Reply to Thread
Results 1 to 3 of 3

Macro - copy information from another sheet to current open sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    06-24-2019
    Location
    Hamar, Norway
    MS-Off Ver
    10
    Posts
    2

    Macro - copy information from another sheet to current open sheet

    Hello!

    Just joined 10 minutes ago...

    I design houses in Norway and we have rules about how much sunlight is required in rooms.
    Having trouble with a calculatingprogram I created for calculating the amount of sunlight that shines in a room through windows in the outer walls.
    The amount of rooms and windows varies from house to house.
    I use one macro for creating a new sheet for each new room, and then in each sheet I can use a macro to add a new window.
    The new window macro finds the information that is needed from a different sheet and then adds the informasjon on the next available line.
    I have added ActiveSheet.Name as the sheet that the information should be pasted in to.

    The problem I have is that the macros work great for the first room. When I am done with the first room and then add a new room with the room macro and then try to add a new window, the new window is added to the first room.

    Here are my macros:

    New room:
    Sub Nytt_rom()
    '
    ' Nytt_rom Makro
    '
    
    '
        Application.ScreenUpdating = False
        Sheets("Hovedberegningsark").Visible = True
        Sheets("Hovedberegningsark").Select
        Sheets("Hovedberegningsark").Copy After:=Sheets(2)
        Sheets("Hovedberegningsark (2)").Select
        Sheets("Hovedberegningsark (2)").Name = "Romnavn"
        Sheets("Hovedberegningsark").Visible = False
        
    End Sub
    New window
    Sub Nytt_vindu()
    '
    ' Nytt_vindu Makro
    '
    
    '
        Application.ScreenUpdating = False
        Sheets("Inndata").Visible = True
        Sheets("Inndata").Select
        Range("A1:N11").Select
        Selection.Copy
        Sheets("Inndata").Visible = False
        Sheets(ActiveSheet.Name).Select
        Cells(Rows.Count, 1).End(xlUp).Offset(3, 0).Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        Range("A39").Select
        
    End Sub

    Would appriciate any help!
    Last edited by alansidman; 06-24-2019 at 05:15 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,706

    Re: Macro - copy information from another sheet to current open sheet

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    06-24-2019
    Location
    Hamar, Norway
    MS-Off Ver
    10
    Posts
    2

    Re: Macro - copy information from another sheet to current open sheet

    Hi
    Ok, will read through the forum rules. Thank you for making me aware of this and adding them for me.

    - Justin

+ 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. VBA/Macro to Automatically Update, Copy, & Sort information from Sheet 1 to Sheet 2
    By E9demello in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-10-2017, 09:37 AM
  2. Copy range from current open sheet to a summary sheet
    By capomo64 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2015, 10:07 AM
  3. [SOLVED] VBA - Macro issue copy/paste line other sheet + duplicate current sheet
    By vcourbiere in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-17-2014, 12:06 PM
  4. Replies: 4
    Last Post: 08-16-2013, 04:10 AM
  5. [SOLVED] Macro Copy and Paste from one sheet to another sheet only where there is information
    By Elmarie_Potgieter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-30-2013, 03:13 AM
  6. [SOLVED] Macro to copy row information from sheet to sheet won't work
    By beth.randall in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-10-2012, 01:31 PM
  7. Replies: 2
    Last Post: 03-14-2012, 03:26 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