+ Reply to Thread
Results 1 to 3 of 3

Macro to copy the copy 4 columns found before last 6 columns

  1. #1
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Macro to copy the copy 4 columns found before last 6 columns

    As the title mentions, I am trying to find a way to find the 4 columns before last 6, copy and insert them right before last 6(these columns contain formulas). Once this is performed, go back to the columns copied and turn them into values and formatting.
    The last 6 columns are always static and won't be removed. I tried writing an offset macro, I tried finding a macro on forums, but I failed miserably. Hopefully someone can help me with this.

    I've attached a sample for reference.
    Attached Files Attached Files
    Click the * to say thanks.

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,892

    Re: Macro to copy the copy 4 columns found before last 6 columns

    Try this

    PHP Code: 
    Sub Macro1()
    Dim lastCol As Long

    lastCol 
    Cells(8Columns.Count).End(xlToLeft).Column
    Cells
    (8lastCol 9).Resize(, 4).EntireColumn.Insert
    Cells
    (8lastCol 5).Resize(, 4).EntireColumn.Copy
    Cells
    (1lastCol 9).PasteSpecial Paste:=xlPasteValues
    Application
    .CutCopyMode False

    End Sub 

  3. #3
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Macro to copy the copy 4 columns found before last 6 columns

    Perfect solution. Thank you!

+ 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: 12-20-2019, 01:49 AM
  2. Replies: 5
    Last Post: 04-18-2019, 12:39 PM
  3. Compare Columns and Copy if match found
    By betsyroal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2014, 07:58 AM
  4. Macro to Copy from 2 Columns, Paste Value in the next 2 Columns, Then clear 1st Columns
    By MHALTTUNEN in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-2014, 03:34 PM
  5. MAcro to - copy, transpose, text to columns, remove column A, combine all columns in 1
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-07-2013, 08:48 AM
  6. Macro to copy 3 columns of data from multiple sheets into 3 columns on 1 sheet
    By bballdcm2007 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-15-2012, 04:37 PM
  7. [SOLVED] Comparing Two Columns and Copy Adjacent Column IF Match Found
    By 10AVATAR in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 09-29-2012, 04:33 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