PDA

View Full Version : Solved: Renewing data upon opening workbook



Aussiebear
01-04-2011, 08:27 AM
On sheet 1 of the attached workbook, I have a named range 'ListA" in B3 to B10, which at the option of the user may be deleted. On reopening the workbook, if cell B3 is blank, I'd like the following code to copy from a hidden list so that the range "ListA" is renewed. The following code is not working as it fails at the line in red

Private Sub Workbook_Open()
Dim C As Range
With Sheet1
If Range("B3").Value = "" Then
For Each C In Range("ListA")
Range(C.Value) = Range(C.Value).Offset(0, -1).Value
Next C
End If
End With
End Sub
What do i need to change?

Bob Phillips
01-04-2011, 09:23 AM
Private Sub Workbook_Open()
Dim C As Range
With Sheet1
If .Range("B3").Value = "" Then
For Each C In .Range("ListA")
C.Value = C.Offset(0, -1).Value
Next C
End If
End With
End Sub

Aussiebear
01-04-2011, 09:31 AM
Thanks bob