ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shifting information from multiple columns to one column (https://www.excelbanter.com/excel-programming/369446-shifting-information-multiple-columns-one-column.html)

Elceller in distress[_2_]

Shifting information from multiple columns to one column
 
I made a macro that copys the information foorm mutiple columns and pastes
the information into a new sheet. The information can be in column:
"A","B","C" or "D" as shown. Is there a way to shift all of the information
to column "A"?

I have this now: (Info put into multiple columns)
A B C D
Info1
Info2
Info3
Info4
Info5

Desired Result:(Info shifted to column "A")

A B C D
Info1
Info2
Info3
Info4
Info5

Thanks for your help

Gazeta

Shifting information from multiple columns to one column
 

Użytkownik "Elceller in distress"
napisał w wiadomości
...
I made a macro that copys the information foorm mutiple columns and pastes
the information into a new sheet. The information can be in column:
"A","B","C" or "D" as shown. Is there a way to shift all of the

information
to column "A"?

I have this now: (Info put into multiple columns)
A B C D
Info1
Info2
Info3
Info4
Info5

Desired Result:(Info shifted to column "A")

A B C D
Info1
Info2
Info3
Info4
Info5

Thanks for your help


try
Sub fill()
For Each cell In Range("a1:a" & ActiveSheet.UsedRange.Rows.Count)
If cell.Value = "" Then
cell.Value = cell.End(xlToRight).Value
cell.End(xlToRight).ClearContents
End If
Next
End Sub
mcg



Elceller in distress[_2_]

Shifting information from multiple columns to one column
 
Thanks "It Worked!"

"Gazeta" wrote:


UÂżytkownik "Elceller in distress"
napisaÂł w wiadomoÂści
...
I made a macro that copys the information foorm mutiple columns and pastes
the information into a new sheet. The information can be in column:
"A","B","C" or "D" as shown. Is there a way to shift all of the

information
to column "A"?

I have this now: (Info put into multiple columns)
A B C D
Info1
Info2
Info3
Info4
Info5

Desired Result:(Info shifted to column "A")

A B C D
Info1
Info2
Info3
Info4
Info5

Thanks for your help


try
Sub fill()
For Each cell In Range("a1:a" & ActiveSheet.UsedRange.Rows.Count)
If cell.Value = "" Then
cell.Value = cell.End(xlToRight).Value
cell.End(xlToRight).ClearContents
End If
Next
End Sub
mcg





All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com