View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Transpose a column list to every other cell in a row on another sheet, then center

Hi Howard,

Am Thu, 13 Aug 2015 22:49:29 -0700 (PDT) schrieb L. Howard:

I want to transpose a column list of names to every other cell in a row on another sheet and then "center across selection" each name with the cell it is in plus the cell to the right.

The list on sheet 1 will vary from 4 to 10, 20 names.


try:

Sub Name_Hours_OPNumber()

Dim vardata As Variant
Dim i As Long, n As Long

Application.ScreenUpdating = False

With Sheets("Sheet1")
vardata = .Range("D7:D" & .Cells(Rows.Count, "D").End(xlUp).Row)
End With
n = 4

For i = LBound(vardata) To UBound(vardata)
With Sheets("Sheet3")
.Activate
.Cells(4, n) = vardata(i, 1)
.Range(Cells(4, n), Cells(4, n + 1)).Select
Selection.HorizontalAlignment = xlCenterAcrossSelection
End With
n = n + 2
Next
Application.ScreenUpdating = True
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional