* :) * Can I copy and paste a value from the worksheet name (from the tab on bottom) and paste it somewhere on by worksheet with VBA?? How? Thanks!! *

brad7989

New Member
Joined
Aug 1, 2011
Messages
45
I have sheets that come in where I have each tab with unique names. There is one cell on each worksheet that I have to copy and paste the name of the worksheet on to (after my macro does a lot). Is there a way I can incorporate this part into my macro so I don't have to?

Thanks so much,

Brad
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Maybe like this

Code:
Sub NameToCell()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
    ws.Range("A1").Value = ws.Name
Next ws
End Sub
 
Upvote 0
Something like this should work...

Code:
  Dim WS As Worksheet
  ....
  ....
  For Each WS In Worksheets
    WS.Range("A1").Value = WS.Name
  Next
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,919
Members
452,949
Latest member
beartooth91

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