I'm kinda new to stackoverflow platform and particularly to VBA, just making my first steps. So I have the following problem: There are several sheets in my workbook and I need to copy names of these sheets except name of one sheet to which I'm copying these names to. Names should be copied to a particular place, too. So far I came up with this:
Sub passport_combining()
Dim i As Worksheet
For Each i In ActiveWorkbook
If i.Name <> "Sheetname_I_dont_need_to_copy_to" Then
Range("G").Value = Range("G" & Rows.Count).End(xlUp).Offset(1).Select.i.Name
ActiveSheet.paste
End If
Next i
End Sub
Code needs to loop through every sheet except the one I'm copying to, derive names from these sheets and copy it to the lastrow + 1 of column G of last sheet I understand technically what I need to do to come up with the solution but I got really stuck in a problem! I even tried to record a macro where I copied sheet names but unfortunately all VBA gives me is bunch of Select options which are advised to be avoided. Any advice would be helpful! Thanks!
The below code import all sheets name in Sheet 1 column A.
Here is one option:
Where "Summary" is the name of sheet on which you want all the names and
.Range("G4")
is the starting place for dataUpdate: Below code will check for value in "Column G" before inserting Sheet Names
Ref: https://stackoverflow.com/a/12648557/9167318
In simple try following
Then adjust codes for your need.