Macro to copy info from one column to another
Closed
kat
-
Jun 4, 2010 at 09:44 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Jun 7, 2010 at 09:08 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Jun 7, 2010 at 09:08 PM
Related:
- Macro to copy info from one column to another
- Spell number in excel without macro - Guide
- Radio info code - Guide
- Potplayer hide info - Guide
- Excel copy column from one sheet to another automatically - Guide
- How to save login info on facebook app - Guide
3 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Jun 5, 2010 at 12:35 AM
Jun 5, 2010 at 12:35 AM
quote
I have an excel worksheet that is currently filtered by a project #. I have certain columns that I would like to copy the information from one column to another. For example, copy column B to J and column A to I. I need for the headers to stay the same at the top which consists of the first two rows.
unquote
FIRST COPY THE FILTERED DATA IN ANOTHER SHEET OF THE FILE SO THAT IT CAN BE RETRIEVED IF THERE IS A MESS UP
try this macro and check whether it does what you want.
about other problems in your postings I shall look into them.
I have an excel worksheet that is currently filtered by a project #. I have certain columns that I would like to copy the information from one column to another. For example, copy column B to J and column A to I. I need for the headers to stay the same at the top which consists of the first two rows.
unquote
FIRST COPY THE FILTERED DATA IN ANOTHER SHEET OF THE FILE SO THAT IT CAN BE RETRIEVED IF THERE IS A MESS UP
try this macro and check whether it does what you want.
Sub copying() Dim r As Range, r1 As Range, r2 As Range Dim j As Long, c As Range Set r = ActiveSheet.UsedRange 'MsgBox r.Address Set r1 = Range(r.Cells(2, 1), r.End(xlDown).End(xlToRight)) 'MsgBox r1.Address Set r2 = r1.Columns("a:B").Cells.SpecialCells(xlCellTypeVisible) 'MsgBox r2.Address For Each c In r2 If c.Rows.Hidden = False Then c.Copy Cells(c.Row, c.Column + 8) End If Next c MsgBox "macro copying is over" End Sub
about other problems in your postings I shall look into them.
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Jun 5, 2010 at 12:42 AM
Jun 5, 2010 at 12:42 AM
your second problem
quote
if any of the cells in the column I am cutting are blank
unquote
what is meant by cells blank
1.do you mean all the filtered cells in the column blank. in that case the whole filtered column to be left as it is with blank cells
or
2.any one or more (not all)of the filtered cells blanks and those blanks will be left blank and other cells to be cut and pasted.
reply quoting my message.
regarding the same second problem
quote
cutting columns F and pasting to E, H to G, K to A, L to B, P to O, R to Q, V to U, X to W, Z to Y AB to AA and AD to AC.
unquote
what is the logic of cutting F and pasting to E(previous column) but not true because K is to be cut and pasted to A
Is there any logic in these requirements.
quote
if any of the cells in the column I am cutting are blank
unquote
what is meant by cells blank
1.do you mean all the filtered cells in the column blank. in that case the whole filtered column to be left as it is with blank cells
or
2.any one or more (not all)of the filtered cells blanks and those blanks will be left blank and other cells to be cut and pasted.
reply quoting my message.
regarding the same second problem
quote
cutting columns F and pasting to E, H to G, K to A, L to B, P to O, R to Q, V to U, X to W, Z to Y AB to AA and AD to AC.
unquote
what is the logic of cutting F and pasting to E(previous column) but not true because K is to be cut and pasted to A
Is there any logic in these requirements.
Yes, #2 is meant by blank cells. In the filtered selection, I will have some cells that are blank and some that have information in them. When the column gets pasted into another column, I want to avoid the blank cells blanking out information that is already in the new column. Also, when I say cut and paste.....I want the information to be cut out but leave the column blank and not remove completely.
2.any one or more (not all)of the filtered cells blanks and those blanks will be left blank and other cells to be cut and pasted.
To answer the second part of your question - there are two columns that don't go in the same order as far as copying one column and pasting to the column right before it. K to A and L to B. If it would make the macro easier to have this changed so that it would be like all the others, I can do that. It's just the way I have it set up.
Thanks for your help!
2.any one or more (not all)of the filtered cells blanks and those blanks will be left blank and other cells to be cut and pasted.
To answer the second part of your question - there are two columns that don't go in the same order as far as copying one column and pasting to the column right before it. K to A and L to B. If it would make the macro easier to have this changed so that it would be like all the others, I can do that. It's just the way I have it set up.
Thanks for your help!
I figured out how to start it at row 3 and also figured out the very last part - blanking out certain columns. I'm still trying to figure out the middle piece, which is to cut certain columns and paste to others, except when the cell is blank, do nothing to those. Also, only want the macro to run on the filtered info.
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Jun 7, 2010 at 09:08 PM
Jun 7, 2010 at 09:08 PM
not clear what you want . In the absence of your database I am not able to understand what I want.
will it be possible for you to upload your file (at least a truncated version)-filtered sheet- in speedyshare.com and explain clearly what you want . In uploading in speedyshae delete the password.
alternately, if the administrator approves, send the file to me as attachment by email and once again explain what you want giving examples with reference to your data
will it be possible for you to upload your file (at least a truncated version)-filtered sheet- in speedyshare.com and explain clearly what you want . In uploading in speedyshae delete the password.
alternately, if the administrator approves, send the file to me as attachment by email and once again explain what you want giving examples with reference to your data