I want a macro that will transfer specific columns from the worksheet "Complete List" to worksheet "494 Sheet" in the order specified. Complete List: A = A on 494 sheet, H = B on 494, O= C on 494 , B = D on 494 , D = E on 494, E = F on 494, K = G on 494, N = H on 494, M = I on 494, and P = J on 494. I have attached to workbook with the exact column names without data. I need the order to appear exactly as it is on the "494 Sheet." Thank you.[ATTACH=CONFIG]40633[/ATTACH]
Macro to transfer data from columns from one sheet to another.
-
-
-
Re: Macro to transfer data from columns from one sheet to another.
Hi Chris
One method, you could do a find of all of the headings in your 494 Sheet in your Complete Index sheet. That way you don't have to worry if the position of the columns change. Just be careful with your heading names as the heading Pct of Occur. has a space in the Complete Index sheet. So your header names have to match for this to run smoothly. I have attached an example file to show how it was done in a test environment.
Take Care
Smallman
Code
Display MoreOption Explicit Sub FindCopy() Dim i As Integer Dim iFind As Integer Dim strFind As String Dim ws As Worksheet Dim sh As Worksheet Set ws = Sheets("Complete Index") Set sh = Sheets("494 Sheet") For i = 1 To 10 strFind = sh.Cells(1, i).Value iFind = ws.Range("A1:Z1").Find(strFind).Column ws.Columns(iFind).Copy Cells(1, i) Next i End Sub
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!