I am trying to write a code that will take a list of titles/names, and create a tab for each one of them, with each worksheet having a name from the list. For example, given a table on the ActiveSheet (might not necessarily be sheet1)
Metric | Comments | Title
1 | testing1 | This is Metric1
2 | testing2 | This is Metric2
I'd like to add 2 worksheets after the ActiveSheet with the names "This is Metric1" and "This is Metric2", respectively (ideally, I'd like to populate cell A1 of each of the new worksheets with "testing1" and "testing2", respectively, as well- gotta walk before we can run though). I'm still relatively new to VBA, so please bare with my faulty code- this is what I've tried so far:
Sub test_tableTOtabs()
Dim fr As Integer
Dim lr As Integer
Dim col As String
fr = Application.InputBox("Starting row of data: ", , 2)
lr = Application.InputBox("Last row of data: ")
col = Application.InputBox("Column for Tab titles: ")
Dim BaseSheet As Worksheet
Set BaseSheet = ActiveSheet
Dim i As Integer
Dim TitleCell As String
Dim title As String
Dim ws As Worksheet
For i = fr To lr
Set TitleCell = col & CStr(i)
title = ActiveSheet.Range("TitleCell").Value
Set ws = Sheets.Add(After:=Sheets(Worksheets.Count))
ws.Name = title
Worksheets(BaseSheet).Activate
Next
End Sub
I know that I am probably overcomplicating this, but I'm not sure how to get this done- please help!