I have a file that is populated with some specific cells in a master file. Rather than copying each cell by explicitly coding for the cell range names, I am trying to copy the value of only those cells that have a "hdr_" at the beginning of their range names.
I can't get the following code to copy anything
For Each nm In wb.Names
If nm.Name Like "hdr_*" Then
On Error Resume Next
' wb.Sheets("Variables").Range(nm.Name).Value = tmp.Sheets("Rates").Range(nm.Name).Value
wb.Range(nm.Name).Value = tmp.Range(nm.Name).Value
On Error GoTo 0
End If
Next nm
When I debug.print the qualifying range names from each workbook the lists match. For some reason the way I am addressing the cells in both worksheets fails. If there is a range name "hdr_item" in both the wb and the tmp workbooks, it seems like the value in the tmp workbook should go to the corrosponding range name in the wb workbook. But it doesn't work. Any ideas? thanks
Ken
I can't get the following code to copy anything
For Each nm In wb.Names
If nm.Name Like "hdr_*" Then
On Error Resume Next
' wb.Sheets("Variables").Range(nm.Name).Value = tmp.Sheets("Rates").Range(nm.Name).Value
wb.Range(nm.Name).Value = tmp.Range(nm.Name).Value
On Error GoTo 0
End If
Next nm
When I debug.print the qualifying range names from each workbook the lists match. For some reason the way I am addressing the cells in both worksheets fails. If there is a range name "hdr_item" in both the wb and the tmp workbooks, it seems like the value in the tmp workbook should go to the corrosponding range name in the wb workbook. But it doesn't work. Any ideas? thanks
Ken