View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
BEEJAY BEEJAY is offline
external usenet poster
 
Posts: 247
Default Macro copied from ng returns a #VALUE!

The body of this macro was cut and pasted from this ng.
The only adjustment made was to change the cell to B2

When I try to run it, it puts #VALUE! in cell B2.
The file was saved (a number of times) prior to running the macro.
The cell was checked and it is formatted as "General".
What else can I check/change?

' WSNCOPY Macro
' From Dave Peterson

Dim wks As Worksheet
Dim myFormula As String

myFormula _
= "=MID(CELL(""filename"",a1),FIND(""]"",CELL(""filename"",a1))+1,255)"

For Each wks In ActiveWorkbook.Worksheets
With wks
.Range("B2").Formula = myFormula
End With
Next wks
End Sub