David,
Tom and I have been working under the assumption that everything was pretty
much happening in columns T and U, we didn't know about AH.
Lets try this instead?
Sub CopyDataTest()
Dim LastColumn As Long
Dim myRowOffset As Long
'find last used column
LastColumn = Range("A2").Offset(0, Columns.Count - 1).End(xlToLeft).Column
'adjust LastColumn to use as an offset from column A
LastColumn = LastColumn - 1
'next get into your test column, T at 1st data item
Range("T2").Select
myRowOffset = ActiveCell.Row - 1
Do Until IsEmpty(ActiveCell.Offset(myRowOffset, 0))
Range("A1").Offset(myRowOffset + 1, LastColumn) = _
Range("A1").Offset(myRowOffset, LastColumn)
myRowOffset = myRowOffset + 1
Loop
End Sub
No cut and paste and no actual movement from cell to cell. This should do
what I think you want, and do it pretty fast.
Here's what it's doing: first it looks for the last used column in row 2 so
as to find the last column with data in it (since you could have headers row
1, but no data under them). It looks from the right edge back left, toward
column A, so that it does not get fooled by any empty cells on a row between
A and the last one with data in it. It takes the column number it finds and
subtracts one from it so that we can use that as an offset from column A to
the column with the data in it.
We move to the first data cell of your 'test' column, T2 and just stay
there! but we find out what row that is (although we know, maybe it won't
always be on row 2, so this allows you to use a different starting row). We
adjust that value to again, use as an offset from this location to test for
an empty cell.
Then we just loop and increment the myRowOffset pointer so that we can test
the proper cell in column T for emptiness, and also use it to 'copy' the data
that's out in the far right column on down the sheet.
To test, I put entries into cells T2:T6 and put an entry into AH2 only. Ran
the code and ended up with the value from AH2 repeated down in all cells to
AH6.
I know it looks a little odd, but once you figure out what I've done to get
the initial values for LastColumn and myRowOffset it becomes clearer.
Remember that .Offset uses the values as an offset from the current active
cell unless you tell it differently. To get the values to be copied/pasted,
I told it specifically to use an offset from cell A1, but to test for the
empty cell, it uses an offset based on the ActiveCell, which we 'forced' to
be T2 and we don't change that during the process.
Hope this helps some with the problem.