+ Reply to Thread
Results 1 to 3 of 3

Error pasting data (including headings) into an excel table when heading is variable

  1. #1
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Error pasting data (including headings) into an excel table when heading is variable

    Hi All,

    I have a set of data that I'm trying to copy and paste a list of data from, including the heading, from one workbook to a table in another workbook. The data that is being pasted includes changes to the table heading at the destination and I can see by manually recording the process that the table uses a different format (List Objects?) that requires the heading name to be known to allow the paste to occur. I tried to get around this by setting the previous heading name as rName and using this in the code to paste the values - see below - however, I keep getting a Run-time error '1004': Method 'range' of 'object'_Global failed.
    Please Login or Register  to view this content.
    This does not work and is where I am getting the error.

    As I can do this manually so I assume it must be possible to replicate via VBA. Can anyone please set me straight?

    Many thanks,
    Dave C

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Error pasting data (including headings) into an excel table when heading is variable

    That's not the right syntax. If Headers and rName are variables, they don't belong inside the quotes.

    Please post an example workbook and code so that we can help you further.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Re: Error pasting data (including headings) into an excel table when heading is variable

    Thank you for your input walruseggman. I figured it was the wrong syntax and that rName may have been part of the issue but after a long day of tinkering with code I have decided to look at my requirements from a different angle. Instead of following through with my original method, I have opted for a simpler solution and have ditched the tables to allow me to use vba methods I am more familiar with.

    I may revisit this issue some time in the future where time permits otherwise my issue has been resolved for now. Thanks again!

+ 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. Excel 2007 VBA - Customised Pivot : Column Heading and Sub Headings
    By BiduraKumar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2015, 08:50 AM
  2. Replies: 0
    Last Post: 04-11-2014, 06:07 PM
  3. Replies: 6
    Last Post: 12-18-2013, 09:11 PM
  4. copy pasting the headings in all the cells till the last data available
    By share knowledge in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-26-2010, 03:46 PM
  5. error in pasting table from excel to powerpoint
    By amid in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2009, 11:31 PM
  6. Inserting a variable in a Table Heading reference
    By dlythgoe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2009, 04:47 PM
  7. How to publish an Excel worksheet as a Web page including heading
    By captainbr in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-11-2006, 12:35 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