Unable to run program for Serpentine

manoj_arsul

Board Regular
Joined
Jun 27, 2018
Messages
61
Can any help me correct the below program

Sub Serpentine()
Dim N As Long, i As Long, j As Long
Dim sh5 As Worksheet

K = 1

Set sh5 = Sheets("Common")

N = sh5.Cells(Rows.Count, "A").End(xlUp).Row

For i = 1 To N
For j = 1 To Columns.Count
If sh5.Cells(i, j) <> "" Then
sh5.Cells(i, 1).Value = sh5.Cells(i, j).Value

K = K + 1
Else
Exit For
End If
Next j
Next i


End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
So what are you wanting to do?
Hard to fix your code when I do not know what you want it to do.
 
Upvote 0
or also guide me for create program for below
1. Copy column " A " from sheet1 (A1 to end)
2.Paste the same in Sheet4 column "A"
3. Copy column " A " from sheet2 (A1 to end)
4.Paste the same in Sheet4 end of Column A
5. Copy column " A " from sheet3 (A1 to end)
6.Paste the same in Sheet4 end of Column A
 
Upvote 0
Manoj, can you explain your issue to someone who is blind and unable to see your PC screen?

What is the sheet name?
What columns need to be combined?
What column does output need to be put into?

Explain the problem in a way that provides all sufficient detail to suggest an answer...
 
Upvote 0
Try:
Code:
Sub Macro1()

    Dim x As Long
    Dim w As Long
    Dim arr() As Variant
    
    For x = 1 To 3
        With Sheets("Sheets" & x)
            w = .Cells(.Rows.Count, 1).End(xlUp).Row
            arr = .Cells(1, 1).Resize(w).Value
        End With
        Sheets("Sheet4").Cells(Rows.Count, 1).End(xlUp).Offset(1).Resize(UBound(arr, 1), UBound(arr, 2)).Value = arr
        Erase arr
    Next x
    
End Sub
 
Last edited:
Upvote 0
Copy column from multiple ( selected ) sheets and paste it in one column of common sheet

Hi ,

I want Copy column from multiple ( selected ) sheets and paste in one column of common sheet .

1. Copy "A" column from sheet name - "AV"
2. Paste the same in "A" Column in Sheet name - "Common"

3. Copy "A" Column from Sheet name - "AD"
4. Paste the same in "A" Column's last row in Sheet name - "Common"

5. Copy "A" Column from Sheet name - "SCCM"
6. Paste the same in "A" Column's last row in Sheet name - "Common"

Don't want to delete any data or rewrite any data.
 
Upvote 0
Re: Copy column from multiple ( selected ) sheets and paste it in one column of common sheet

Try:
Code:
Sub CopyCol()
    Application.ScreenUpdating = False
    Dim ws As Worksheet
    For Each ws In Sheets(Array("AV", "AD", "SCCM"))
        ws.Range("A1:A" & ws.Range("A" & ws.Rows.Count).End(xlUp).Row).Copy Sheets("Common").Cells(Sheets("Common").Rows.Count, "A").End(xlUp).Offset(1, 0)
    Next ws
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Re: Copy column from multiple ( selected ) sheets and paste it in one column of common sheet

@manoj_arsul
In future please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.

I have merged both threads
 
Upvote 0
Re: Copy column from multiple ( selected ) sheets and paste it in one column of common sheet

Thank u thank u so much
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top