Learn when you want, where you want with convenient online training courses. Sign up now!
[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Dim ShArr, Sh
Dim dws As Worksheet, ws As Worksheet
Dim lr As Long, lc As Long, i As Long, dlc As Long
Application.ScreenUpdating = False
Set dws = Sheets("Sheet5")
ShArr = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")
For Each Sh In ShArr
Set ws = Sheets(Sh)
lr = ws.Cells(Rows.Count, 1).End(xlUp).Row
If dws.Range("A1").Value = "" Then ws.Range("A2:A" & lr).Copy dws.Range("A1")
For i = 2 To lr
lc = ws.Cells(i, Columns.Count).End(xlToLeft).Column
If lc > 1 Then
dlc = dws.Cells(i - 1, Columns.Count).End(xlToLeft).Column + 1
ws.Range("B" & i, ws.Cells(i, lc)).Copy dws.Cells(i - 1, dlc)
Application.ScreenUpdating = True
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.