Get the worksheet tag name and put into a column

techissue2008

Board Regular
Joined
Jun 13, 2008
Messages
80
Hi,

I re-named the worksheet tags 2007/08, 2006/07 instead of Sheet 1, Sheet 2.

In Sheet 3 (A:C), it will get all data from '2007/08' sheet by using .Range.

I want to show the tag name 2007/08 in Sheet 3 (D:D) upon the end of the range.

i.e.
2007/08
2007/08
2007/08
2007/08
2007/08
2007/08
.....
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Is this a VBA question? If so, are you copying the data across (seems likely) or would a dynamic link (ie a formula) suit you better?


Code:
Dim rng As Range
 
With Sheet1
  Set rng = .Range("A1:C" & .Cells(.Rows.Count,"A").End(xlUp).Row)
End With
rng.Copy
Sheet2.Range("A1").PasteSpecial xlPasteValues
Sheet2.Range("D1:D" & rng.Rows.Count).Value = Sheet1.Name
 
Upvote 0
Code:
With Sheets("sheet3").Range("a1").CurrentRegion
    .Resize(,1).Offset(,2).Value = Sheets(1).Name
End With
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,790
Members
448,994
Latest member
rohitsomani

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