Transfer Data from one sheet to another Sheet

fahadalambd

New Member
Joined
Sep 16, 2022
Messages
31
Office Version
  1. 2016
Platform
  1. Windows
Hi Everyone,

Hope you guys are well.

In the attached pics I have two sheets - "Sheet1" and "Sheet2" in the same Excel file.

I need to transfer the data on the "COUNT" Column from "Sheet1" to "Sheet2"

Thanks in advance.
 

Attachments

  • Sheet1.png
    Sheet1.png
    21.9 KB · Views: 19
  • Sheet2.png
    Sheet2.png
    18.7 KB · Views: 18

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Can there be more than 2 tables? Can the number of items in each table be different?
 
Upvote 0
Thanks for the reply.

No, now I have only 2 Tables in Sheet1.

The number of items in each table may be the same or different. For example, the data in column 1 "Ball" has 2 types in Column 2 which are "new" and "old"

I want to transfer all the data on the "COUNT" Column from "Sheet1" to "Sheet2"
 
Upvote 0
This macro is based on the pictures you posted. If your actual data is organized differently, the macro won't work.
VBA Code:
Sub CopyData()
    Application.ScreenUpdating = False
    Dim LastRow As Long, i As Long, fRow As Long, lRow As Long, srcWS As Worksheet, desWS As Worksheet, col As String: col = "C"
    Set srcWS = Sheets("Sheet1")
    Set desWS = Sheets("Sheet2")
    With srcWS
        LastRow = .Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        With .Range("A1:A" & LastRow).SpecialCells(xlCellTypeConstants)
            For i = 1 To .Areas.Count
                fRow = .Areas(i).Cells(1).Row
                lRow = .Areas(i).Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
                desWS.Range(col & 3).Resize(lRow - fRow - 1).Value = srcWS.Range("C" & fRow + 2).Resize(lRow - fRow - 1).Value
                col = "H"
            Next i
        End With
    End With
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
Thank you so much Genius. Appreciate a lot for your help.

You save my life! Thanks again for your enormous help :)
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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