Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop Problem
I am using a loop to try and copy information in a vertical range to be
displayed in a horizontal range as the next values at the bottom of a list so far i have: Private Sub Insert_Click() Dim x, y x = 4 Do Until y = 45 If Sheets("sheet2").Cells(x, 45) = "" Then Range(Cells(10, 6), Cells(19, 6)).Copy _ Destination:=Range(Sheets("sheet2").Cells(x, 45), Sheets("sheet2").Cells(x, 54)) y = 45 End If x = x + 1 Loop End Sub but this just copies the vertical range of values multiple times across the specified copy range, not transposing it as i would like it to do. any suggestions would be much appreciated regards Patrick |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop Problem
Patrick,
Try this (not tested): Private Sub Insert_Click() Dim x, y x = 4 Do Until y = 45 If Sheets("sheet2").Cells(x, 45) = "" Then Range(Cells(10, 6), Cells(19, 6)).Copy Range(Sheets("sheet2").Cells(x, 45).PasteSpecial Transpose:=True y = 45 End If x = x + 1 Loop End Sub Mark Lincoln On Aug 30, 10:46 am, Patrick Bateman wrote: I am using a loop to try and copy information in a vertical range to be displayed in a horizontal range as the next values at the bottom of a list so far i have: Private Sub Insert_Click() Dim x, y x = 4 Do Until y = 45 If Sheets("sheet2").Cells(x, 45) = "" Then Range(Cells(10, 6), Cells(19, 6)).Copy _ Destination:=Range(Sheets("sheet2").Cells(x, 45), Sheets("sheet2").Cells(x, 54)) y = 45 End If x = x + 1 Loop End Sub but this just copies the vertical range of values multiple times across the specified copy range, not transposing it as i would like it to do. any suggestions would be much appreciated regards Patrick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
For Loop Problem | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming | |||
Problem with Do Loop and If | Excel Programming | |||
Loop Problem | Excel Programming |