Find first value in row + add following values (Please, Urgent)

E

Evgeny

Hello,

I wonder if there is an easy way to find the first value in a row and put it
in column 1, the second value in that row will go to column 2, etc.
Example:
A B C D E... K L M N O P Q R S T V etc

3 5 2 4 8 3 5 2 4 8
5 4 8
5 4 8
6 8 2 1 9 6 8 2 1 9

Thank you very much,


Evgeny
 
G

Gary''s Student

Select the first cell in the row. While hold down the shift key, touch
end,right-arrow,left arrow and then release the shift key.


The pull-down:
Edit > Delete... > Shift cells left
 
E

Evgeny

Thanks, Gary

But I have 756 rows and 150 columns. I cannot do it manually every time. The
data is inputted from other sheets and I need the values to be organized in
first 18 columns for a report.
So, I need the values from rows to be shifted left, one after another,
dynamically (I will just paste values in, let's say, column GY, and if this
is the first value, it needs to be in column A, if it's 2nd value in row - it
goes to column B)


I appreciate your help,

Evgeny
 
G

Gary''s Student

You need a macro. Enter this:

Sub Macro1()
For i = 1 To 10
Cells(i, 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Resize(1, Selection.Columns.Count - 1).Select
If Selection.Count < 255 Then
Selection.Delete Shift:=xlToLeft
End If
Next
End Sub


As coded it works on the first 10 rows. You can modify the FOR loop to
cover any rows you wish.
 
E

Evgeny

Thanks a lot!

It works great!


Evgeny

Gary''s Student said:
You need a macro. Enter this:

Sub Macro1()
For i = 1 To 10
Cells(i, 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Resize(1, Selection.Columns.Count - 1).Select
If Selection.Count < 255 Then
Selection.Delete Shift:=xlToLeft
End If
Next
End Sub


As coded it works on the first 10 rows. You can modify the FOR loop to
cover any rows you wish.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top