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
 

Trevor_S

Well-known Member
Joined
Oct 17, 2015
Messages
604
Office Version
2016
Platform
Windows
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
 

Forum statistics

Threads
1,082,360
Messages
5,364,920
Members
400,815
Latest member
Joaquin Phoenix

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top