• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to Write Formula into Specific Cell, and then Paste Values

bkanne

Member
Hi,

If possible, could someone please help me write the following macro?

I need to make Cell B3 in the active (or preferably all selected sheets) to:

1) Drop in the following formula: =+MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,256)

2) Then calculate the spreadsheet,

3) and then paste values (just for those specific cells).

This formula will make cell B3 in each selected worksheet equal to the name of each individual worksheet.

The reason I don't leave this formula in place is that it creates an external link to itself, which I would like to remove.

Thank you so much!
Ben
 
I typically do that, but in this case, there is no sample file to upload - I would just be uploading a blank spreadsheet. This is a generic question that applies to literally any spreadsheet.
 
Try this :-
Code:
Sub TabNameToB3()
Dim SheetNames As String
       
    SheetNames = ActiveSheet.Name

    For J = 1 To ActiveWorkbook.Sheets.Count
        Sheets(J).Cells(3, 2).Value = Sheets(J).Name
    Next
End Sub
 
Back
Top