Dragging Formula and only the Worksheet changing.
Hey Guys,
I have a question that I hope you are able to hepl me with.
I have multiple worksheets in my spreadsheet. I want to drag a formula down a column but only change the worksheet in the formula, due to there being so many worksheets, doing it manually would take a lifetime: For example.
Worksheets: A1, B1, C3, D4 ETC.
The formula I need to drag is: ='A1'!$D$15
Down the column should read: ='A1'!$D$15, ='B2'!$D$15, etc
Thanks for your help in advance!!
Snoogy
Hi Snoogy, Give this Macro a
Hi Snoogy,
Give this Macro a shot (Insert your formula where it says $D$15, make sure you leave the quotation marks:
Sub Snoogy()
Dim NumWs As Integer
Dim Count As Integer
NumWs = Worksheets.Count
Count = 1
Do Until Count = NumWs + 1
ActiveCell.Offset(Count - 1, 0) = "='" & Worksheets(Count).Name & "'!" & "$D$15"
Count = Count + 1
Loop
End Sub
Let me know if this doesnt work or if you need anything else!
Sincerely,
-Max
Also
Also - If your formula contains multiple variables on other sheets, give me the actual formula you need and I'll build it out in VBA!