LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default macro - copy, paste, convert column data

I have data as follows:

I J
Inv Date SO No.
08-Jun-06 5
05-Jan-05 3
01-Nov-05 4
05-Jan-04 2

The data in column 'I' can vary from 10 to 1000 records depending on the
years select. I have recorded a macro to copy column I to K which still shows
the date format dd-mmm-yy. Recorded another macro to convert Col K to show
only €˜YYYY format in Col L and then copy Col L and Paste Special as Value
into Col M.
I am not sure how to get the macro to select the data available from Col K
and copy to Col L. I have used the AutoFill and that is the problem - the
data fills only up to those cells and not any cells after that.

Is there an easier way of writing the macro to get it to select whatever
data there is in Col I, copy it to Col K showing only the year format.?
Would appreciate any help possible.

I J K L M
Inv Date SO No. FirstYear
08-Jun-06 5 08-Jun-06 2006 2006
05-Jan-05 3 05-Jan-05 2005 2005
01-Nov-05 4 01-Nov-05 2005 2005
05-Jan-04 2 05-Jan-04 2004 2004



Sub CopyInvDate()

Columns("I:I").Select
Application.CutCopyMode = False
Selection.Copy
Range("K1").Select
ActiveSheet.Paste
Range("K1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "FirstYear"
Range("K2").Select
Call CopyDateConvert
End Sub

Sub CopyDateConvert()
Range("L2").Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-1],""yyyy"")"
Range("L2").Select
Selection.AutoFill Destination:=Range("L2:L278")
Range("L2:L278").Select
Selection.Copy
Range("M2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy a column and paste to another tab to save the data for each m liem Excel Discussion (Misc queries) 3 January 17th 10 03:14 AM
A macro to copy & paste many rows (a range) to the next column .. genehunter New Users to Excel 11 April 21st 09 07:36 AM
copy data and formulas from a column and paste into a row john.laffe[_2_] Excel Worksheet Functions 1 December 12th 07 02:59 PM
Macro Syntax to copy and paste dynamic data based on one column jbsand1001 Excel Programming 0 May 17th 05 02:49 PM
Copy/Paste Macro and Column Sizing JimK Excel Programming 2 August 27th 04 06:08 PM


All times are GMT +1. The time now is 06:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"