Sheet One Items Transferred to Sheet Two.
Closed
srigopal
-
Mar 3, 2015 at 09:19 PM
vcoolio Posts 1371 Registration date Thursday July 24, 2014 Status Moderator Last seen April 12, 2023 - Mar 10, 2015 at 02:28 AM
vcoolio Posts 1371 Registration date Thursday July 24, 2014 Status Moderator Last seen April 12, 2023 - Mar 10, 2015 at 02:28 AM
Related:
- Sheet One Items Transferred to Sheet Two.
- How to screenshot excel sheet - Guide
- Little alchemy cheat sheet - Guide
- How to copy data from one sheet to another in excel automatically - Guide
- Google sheet right to left - Guide
- Cmd network commands cheat sheet - Guide
3 replies
venkat1926
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
810
Mar 4, 2015 at 12:38 AM
Mar 4, 2015 at 12:38 AM
get list of unique tankers using advanced filter
then autofilter data for each unique tanker number and add worksheet with name as tanker number and paste it there (only filtered data will e pasted)
loop for each unique tanker number
try to do it manually (opening "record macro") and then edit the macro
then autofilter data for each unique tanker number and add worksheet with name as tanker number and paste it there (only filtered data will e pasted)
loop for each unique tanker number
try to do it manually (opening "record macro") and then edit the macro
vcoolio
Posts
1371
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
April 12, 2023
252
Mar 4, 2015 at 01:12 AM
Mar 4, 2015 at 01:12 AM
Hello Srigopal,
The following code may do as you ask:-
It transfers all data to each tanker's relevant sheet.
You can have a look at my test work book here:-
https://www.dropbox.com/s/3ctqx2573q10fyz/Srigopal.xlsm?dl=0
to see how it works.
I have moved the "Tanker No." to Column A and the "S. No." to Column B. It just simplified things a little.
The code also clears all data from the "Input" sheet once the transfer of data is complete. This will prevent duplicates in the Tanker sheets but I also assumed that you would not want "used" data cluttering up your "Input" sheet.
I hope that this helps.
Regards,
vcoolio.
The following code may do as you ask:-
Sub TransferData() Application.ScreenUpdating = False Dim lRow As Long Dim ws As Worksheet, ws1 As Worksheet, ws2 As Worksheet, ws3 As Worksheet, ws4 As Worksheet Set ws = Worksheets("Input") Set ws1 = Worksheets("1325") Set ws2 = Worksheets("4433") Set ws3 = Worksheets("5555") Set ws4 = Worksheets("7432") ws.Select lRow = Range("A" & Rows.Count).End(xlUp).Row For Each Cell In Range("A2:A" & lRow) If Cell = 1325 Then Cell.EntireRow.Copy ws1.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) ElseIf Cell = 4433 Then Cell.EntireRow.Copy ws2.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) ElseIf Cell = 5555 Then Cell.EntireRow.Copy ws3.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) ElseIf Cell = 7432 Then Cell.EntireRow.Copy ws4.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) End If Next Cell Sheets("Input").Range("A2:F" & Rows.Count).ClearContents MsgBox "Data transfer completed!", vbExclamation Application.ScreenUpdating = True End Sub
It transfers all data to each tanker's relevant sheet.
You can have a look at my test work book here:-
https://www.dropbox.com/s/3ctqx2573q10fyz/Srigopal.xlsm?dl=0
to see how it works.
I have moved the "Tanker No." to Column A and the "S. No." to Column B. It just simplified things a little.
The code also clears all data from the "Input" sheet once the transfer of data is complete. This will prevent duplicates in the Tanker sheets but I also assumed that you would not want "used" data cluttering up your "Input" sheet.
I hope that this helps.
Regards,
vcoolio.
vcoolio
Posts
1371
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
April 12, 2023
252
Mar 4, 2015 at 01:15 AM
Mar 4, 2015 at 01:15 AM
Hello Venkat,
My apologies for intruding. We must have posted at the same time!
I'll leave it with you.
Regards,
vcoolio.
My apologies for intruding. We must have posted at the same time!
I'll leave it with you.
Regards,
vcoolio.
vcoolio
Posts
1371
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
April 12, 2023
252
>
srigopal
Mar 4, 2015 at 03:16 AM
Mar 4, 2015 at 03:16 AM
Hello Srigopal,
Just delete line 30 from the code and all the data will remain in The "Input" sheet also. But, remember, this will create duplicates in all the Tanker sheets. Do you want the data duplicated?
Regards,
vcoolio.
Just delete line 30 from the code and all the data will remain in The "Input" sheet also. But, remember, this will create duplicates in all the Tanker sheets. Do you want the data duplicated?
Regards,
vcoolio.
venkat1926
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
810
Mar 4, 2015 at 05:37 AM
Mar 4, 2015 at 05:37 AM
It is ok. no need for apologies.
vcoolio
Posts
1371
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
April 12, 2023
252
>
venkat1926
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
Mar 4, 2015 at 05:41 AM
Mar 4, 2015 at 05:41 AM
Cheers my friend.
Mar 4, 2015 at 12:51 AM