Windows 7
Excel 2007
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
I am trying to make to relative worksheet reference within a range of cells while doing a copy of a template worksheet. The copy below is working ok when running my “Results worksheet” except reference cell to A11 or =SheetName(A1,TRUE) is not copying in the correct value from my sheets that have been copied from my template.
<o
></o
>
Here is the copy I am currently using in my for loop in “Results Summary”:<o
></o
>
ws.Range("A1:D12").Copy Destination:=Sheets("Results Summary").Cells(Rows.count, "A").End(xlUp).Offset(1)
count = count + 13
<o
></o
>
The function here is located in my template updates cell (A11) to be the active sheet name once the sheet has been copied.<o
></o
>
Function SheetName(rCell As Range, Optional UseAsRef As Boolean) As String
Application.Volatile
If UseAsRef = True Then
SheetName = "" & rCell.Parent.Name & ""
Else
SheetName = rCell.Parent.Name
End If
End Function
<o
></o
>
How do I update the ws.range to compensate for this? Currently every range instead of the newly copied sheet name it has “Results Summary” in the referenced cell.
Thank you for any help in advance!
Excel 2007
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com




I am trying to make to relative worksheet reference within a range of cells while doing a copy of a template worksheet. The copy below is working ok when running my “Results worksheet” except reference cell to A11 or =SheetName(A1,TRUE) is not copying in the correct value from my sheets that have been copied from my template.
<o


Here is the copy I am currently using in my for loop in “Results Summary”:<o


ws.Range("A1:D12").Copy Destination:=Sheets("Results Summary").Cells(Rows.count, "A").End(xlUp).Offset(1)
count = count + 13
<o


The function here is located in my template updates cell (A11) to be the active sheet name once the sheet has been copied.<o


Function SheetName(rCell As Range, Optional UseAsRef As Boolean) As String
Application.Volatile
If UseAsRef = True Then
SheetName = "" & rCell.Parent.Name & ""
Else
SheetName = rCell.Parent.Name
End If
End Function
<o


How do I update the ws.range to compensate for this? Currently every range instead of the newly copied sheet name it has “Results Summary” in the referenced cell.
Thank you for any help in advance!