Loop through column extract data paste to matching tab

TravelingMan

New Member
Joined
Jun 8, 2015
Messages
8
I have 4 tabs of different #'s 201, 202, 203, 204
In a master tab I am dumping data...

I have a suite column that has suite #'s and dates
Each of the 4 suites and their dates are in this master data list.

I am trying to get a macro that will loop through column and insert each suite and its corresponding dates into its numbered tab
I.e.
201
Date
Date
Date
Date
202
Date
Date
Date
203
Date
Date
Date
Date
Date
204
Date
Date

This would be separated into each corresponding numbered tab and
Suite numbered would be duplicated while dates would be put in the date column

Basically moving the data from column one 1 master sheet to corresponding columns and separating dates and suite numbers
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Try the following. It assumes that, as in your example, the suite numbers and worksheet names are numeric and (relatively!) low. In the fourth line, the <1000 needs to be any number that is higher than the highest suite number, but not so high that it may get confused with dates (current dates are 5 digit numbers). I've also assumed that your master tab is named Data - amend the macro to whatever it is actually called.

Code:
Sub testmacro()
myCopyRow = 0
Do
    If Range("Data!A1").Offset(myCopyRow, 0).Value < 1000 Then
        mySheetName = Range("Data!A1").Offset(myCopyRow, 0).Value
        myPasteRow = 0
    Else
        Range(mySheetName & "!A1").Offset(myPasteRow, 0).Value = mySheetName
        Range(mySheetName & "!A1").Offset(myPasteRow, 1).Value = Range("Data!A1").Offset(myCopyRow, 0).Value
        myPasteRow = myPasteRow + 1
    End If
    myCopyRow = myCopyRow + 1
    If Range("Data!A1").Offset(myCopyRow, 0).Value = "" Then Exit Do
Loop
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,716
Members
449,093
Latest member
Mnur

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