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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
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

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
Code:
With Sheets("sheet3").Range("a1").CurrentRegion
    .Resize(,1).Offset(,2).Value = Sheets(1).Name
End With
 
Upvote 0

Forum statistics

Threads
1,191,191
Messages
5,985,216
Members
439,948
Latest member
Xearo96

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
Top