Results 1 to 4 of 4

Copying column with merged rows

Threaded View

noclass1980 Copying column with merged... 02-06-2013, 08:48 AM
Andrew-R Re: Copying column with... 02-06-2013, 09:03 AM
noclass1980 Re: Copying column with... 02-06-2013, 10:11 AM
Andrew-R Re: Copying column with... 02-06-2013, 10:14 AM
  1. #1
    Registered User
    Join Date
    09-27-2012
    Location
    Warrington, England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Copying column with merged rows

    I have a simple spreadsheet comprising columns A to F. I want to copy just column D using VBA and copy to another column (as part of a larger macro). Simple so far. However. a number of the rows have the columns merged across all 6 so when I select the column using VBA all the columns are selected and copied. I just need to copy column D. My code is:

    SelectedColumn="D" 'this is a user defined input variable
    Columns(SelectedColumn).Select ' this is where it selects all columns A to F
    Selection.Copy
    i also tried with FirstRow and LastRow as variables corresponding to the first and last row to be copied but it still didn't work.

    SelectedColumn="D" 'this is a user defined input variable
    Columns(SelectedColumn & FirstRow,SelectedColumn & LastRow ).Select ' this is where it selects all columns A to F
    Selection.Copy
    but if I use Record Macro and click on column D at the top, I get
    Columns("D:D").Select
    Selection.Copy
    and this ignores the rows with the merged columns.

    Any suggestions? It would not be practicable to unmerge or delete the rows with the merged columns.

    Thanks in advance.
    Last edited by noclass1980; 02-06-2013 at 09:05 AM. Reason: Additional information added

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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