Combine columns in excel
Solved/Closed
Related:
- How to combine debits and credits into one column in excel
- Combine notifications viber - Guide
- Excel mod apk for pc - Download - Spreadsheets
- How to open excel file in notepad - Guide
- How to delete column in word - Guide
- How to convert number to words in excel - Guide
2 responses
Dear Carman,
Please get through the following Kioskea FAQ article in order to get the task completed.
https://ccm.net/faq/
Thank you.
Please get through the following Kioskea FAQ article in order to get the task completed.
https://ccm.net/faq/
Thank you.
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Jul 19, 2010 at 05:04 AM
Jul 19, 2010 at 05:04 AM
Try this
This is based on assumption that columns in both sheets are in same order and at same location
This is based on assumption that columns in both sheets are in same order and at same location
Try this
Sub CopyData()
Dim lSrcMaxRows As Long
Dim lTgtLastRow
Dim Cell As Range
Dim sTgtSht As String
Dim sSrcSht As String
sSrcSht = "Sheet2"
sTgtSht = "Sheet1"
Sheets(sSrcSht).AutoFilterMode = False
Set Cell = Sheets(sSrcSht).Cells.Find("*", Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
If Cell Is Nothing Then Exit Sub
lSrcMaxRows = Cell.Row
Sheets(sTgtSht).AutoFilterMode = False
Set Cell = Sheets(sTgtSht).Cells.Find("*", Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
If Cell Is Nothing Then
lTgtLastRow = 0
Else
lTgtLastRow = Cell.Row
End If
lTgtLastRow = lTgtLastRow + 1
Application.CutCopyMode = False
Sheets(sSrcSht).Select
If (lTgtLastRow = 1) Then
Rows("1:" & lSrcMaxRows).Copy
Else
Rows("2:" & lSrcMaxRows).Copy
End If
Sheets(sTgtSht).Select
Cells(lTgtLastRow, "A").PasteSpecial
Application.CutCopyMode = False
Set Cell = Nothing
End Sub