+ Reply to Thread
Results 1 to 3 of 3

Excel VBA to select header from Sheet1 at A1 to the end of the table, and paste it to ...

  1. #1
    Registered User
    Join Date
    10-20-2020
    Location
    London, England
    MS-Off Ver
    365
    Posts
    5

    Excel VBA to select header from Sheet1 at A1 to the end of the table, and paste it to ...

    Excel VBA to select header from Sheet1 at A1 to the end of the table, and paste it to another Sheets

    This is the Sheet1 and I've renamed it to s1

    b4Gdu.png

    Then, I created 2 new sheets, name it as s2 and s3. It works.

    Please Login or Register  to view this content.
    Next step was to copy A1:C1 from s1, and paste it to s2 and s3 also at A1:C1

    Please Login or Register  to view this content.
    Unfortunately, it didn't work. Instead of pasting the content of A1:C1 from s1, it just selected from A1 to the end on sheet s2 and s3.

    gWx47.png

    Desired output on both s2 and s3

    NXYy2.png

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Excel VBA to select header from Sheet1 at A1 to the end of the table, and paste it to

    Hi 11392,

    Try below code ...
    Please Login or Register  to view this content.
    Last edited by nankw83; 11-03-2020 at 10:16 AM. Reason: Shorter code ...
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Excel VBA to select header from Sheet1 at A1 to the end of the table, and paste it to

    Quote Originally Posted by 11392 View Post
    Unfortunately, it didn't work. Instead of pasting the content of A1:C1 from s1, it just selected from A1 to the end on sheet s2 and s3.
    The reason your code is not giving you the desired output is it is copying the range of the 'Active' sheet ... You need to assign it to read from sheet s1
    Please Login or Register  to view this content.

+ 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. Replies: 1
    Last Post: 01-13-2020, 05:18 PM
  2. [SOLVED] Paste row A1 above each separated table in Sheet1
    By bigmacro in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-27-2018, 04:02 PM
  3. Replies: 1
    Last Post: 10-05-2013, 03:35 PM
  4. Replies: 0
    Last Post: 01-03-2013, 07:10 AM
  5. [SOLVED] Copy and Paste Entire Row from Sheet1->Sheet2 based on text string match in Sheet1 Row
    By dmlovic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-17-2012, 08:42 AM
  6. Excel: custom header - is it possible to paste into header?
    By Maureen D. in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-04-2005, 11:10 AM
  7. Sheet1.Activate vs Sheet1.Select
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-11-2005, 11:30 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