Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-25-2019, 07:48 AM
alpha alpha is offline Align vertical data horizontally while copying previous columns along Windows 10 Align vertical data horizontally while copying previous columns along Office 2010 64bit
Novice
 
Join Date: Jun 2018
Posts: 18
alpha is on a distinguished road
Default

You can use this macro (place it in a module):
Code:
Sub macro1()
Dim r As Integer, x As Integer, y As Integer, lk As Integer
With Sheets(2)
.Columns("a:k").Delete
Application.ScreenUpdating = False
.Cells(1, 10) = "Milestone_Date": .Cells(1, 11) = "Milestone_Type"
.Range("j1:k1").Interior.ColorIndex = 3
Sheets(1).Range("a1:i1").Copy .Range("a1:i1")
End With
r = 2: y = 2
Do Until IsEmpty(Sheets(1).Cells(r, 1))
With Sheets(1)
lk = .Cells(r, .Columns.Count).End(xlToLeft).Column
.Range(.Cells(r, 1), .Cells(r, 9)).Copy Sheets(2).Cells(y, 1)
.Range(.Cells(r, 10), .Cells(r, lk)).Copy
End With
With Sheets(2)
.Cells(y, 10).PasteSpecial Transpose:=True
.Range(.Cells(y, 1), .Cells(y + lk - 10, 9)).FillDown
For x = 1 To lk - 9
With .Cells(y, 11)
.Value = "Milestone " & x
.Interior.ColorIndex = 23
End With
y = y + 1
Next x
.Columns("a:k").AutoFit
End With
r = r + 1
Loop
With Application
.CutCopyMode = False
.Goto reference:=Range("a1")
.ScreenUpdating = True
End With
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vertical Text Alignment with Adjacent Columns kdutrisac Word Tables 2 06-26-2017 12:38 PM
Copying specific columns of a table to WORD and deleting rows ffinley Word VBA 5 12-07-2015 04:01 PM
Align vertical data horizontally while copying previous columns along Copying and pasting values with unequal data columns grexcelman Excel Programming 5 12-05-2014 11:36 AM
Align vertical data horizontally while copying previous columns along Vertical align to bottom of cell when row wraps to next page lausianne Word Tables 3 02-28-2014 05:20 PM
Align vertical data horizontally while copying previous columns along Copying data from sheet with deleted columns creates blanks ZGreyArea Excel 1 11-20-2013 10:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft