VBA to Copy Tab Name and Populate Column

VBA learner ITG

Active Member
Joined
Apr 18, 2017
Messages
272
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Thank you for looking at my post.

I was wondering if I could get your advice or guidance to a solution for my VBA issue.

I want to populate column A4 to A23 automatically on a Tab called "Saving Calculator" with the name of the tab or tabs that that the below VBA code creates.

Ideally if A4 was already named from a tab it would look at A5 and populate it with the new tab name and so forth until all blank cells in column A4 to A23.

Sub Copy_paste_tab()


Dim ws As Worksheet
Set wh = Worksheets(ActiveSheet.Name)
ActiveSheet.Copy After:=Worksheets(Sheets.Count)
If wh.Range("D5").Value <> "" Then
ActiveSheet.Name = wh.Range("D5").Value
End If
wh.Activate


End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Just to give you an update:

I have found the below VBA code which works but i was wondering how do i go about getting the data into the Tab called "savings Calculator" in column A4 downwards?

Sub Insert_Tab_Into_Cell()


Columns(1).Insert
For i = 1 To Sheets.Count
Cells(i, 1) = Sheets(i).Name
Next i


End Sub
 
Upvote 0
Dear readers,

Instead of using VBA code I have decided to go with a formula which is dynamic to populate the tab names in my document.

I am using Mac (excel 365) so for me i had to go to:

Formulas - Define Name
Name for Data Range: Sheets
Select Range Cells: =TRANSPOSE(GET.WORKBOOK(1))&T(NOW())

In the workbook I entered the below formula into the cell and it is dynamic that will add and remove tabs created.

=IFERROR(INDEX(MID(sheets,FIND("]",sheets)+1,255),ROW(A1),1),"")


SORRY TO WASTE ANYONE TIME AND I HOPE THIS HELPS ANYONE IN THE SAME SITUATION AS ME!!!!!!!!!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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