Hi all! I am new to VBA, and I have taken on (what seems to me) a hard task.
I need a macro that will find the last column in a sheet, then go 3 columns left and copy the data (formulas and all) in that column. Then I need to insert the copied column to the right while retaining data in the columns to the right.
I know right now I am nowhere near the mark... Actually I just started learning VBA about an hour and a half ago, so be easy on me.
This is what I have so far:
Note that I used "IV10". This is just because most of my data starts at row 10.Sub FindLastColumn() Dim LastColumn As Range Set LastColumn = Range("IV10").End(xlToLeft) With LastColumn With .EntireColumn .Copy .Offset(, -3) Selection.Insert Shift:=x1toright .Copy .PasteSpecial xlPasteAll End With End With Application.CutCopyMode = False End Sub
Also, I don't know how to do any other paste than Paste Special, so helping me correct this is also great.
Thanks in advance for all those willing to help!!
(I can also attach a generic spreadsheet if my explanation is vague)
hi cdustybk, I have slightly modified your code, you were close:Sub FindLastColumn() Dim LastColumn As Range Set LastColumn = Cells(11, Columns.Count).End(xlToLeft) With LastColumn With .EntireColumn .Copy .Offset(, -3) .Insert Shift:=x1toright End With End With End Sub
Please leave a message after the beep!
Thank you, Mordred for replying so fast. This is almost what I need. However, instead of copying the last column and inserting it, I need the column 3 from the last one to be copied and pasted. However, I may be able to mess with the code and figure it out. VBA is pretty intimidating!
Thanks for your help though! Rep+1!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks