Right Most Column

D

Darren Woodbrey

I need to copy the value in the right most column of each field to a column
next to it.

A B C D E H
1 5.00 6.00 3.00 3.00
2 6.00 6.00
3 2.50 3.50 4.00 5.00 5.00

Is there anyway to do this? Thanks!
 
D

duane

' this assumes all rows have an entry in column B and there is no header
row
' if there is a header row then add a "- 1" to firstrow calculation

Sub Macro1()
Dim lastrow As Integer
Dim firstrow As Integer
Dim colum As Integer
Sheets("sheet1").Select
lastrow = Cells(10000, 2).End(xlUp).Row
firstrow = Cells(lastrow, 2).End(xlUp).Row
For i = firstrow To lastrow
colum = Cells(i, 2).End(xlToRight).Column
If colum = 256 Then colum = 2
Cells(i, colum).Copy Cells(i, colum + 1)
Next i
End Sub
 
D

duane

sorry- make that change a "+ 1" if there is a header row....I wish I
could think and type..............
 

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