D
dipsy
Hi:
The Code below works when the sheet is activated. However
when the code does not work - "'With Sheets(Name)"
Any help in explaining this is greatly appreciated.
TIA.
Sub resetdata()
Dim SheetName(1) As String
SheetName(0) = "2004"
SheetName(1) = "2004Data"
For Each Name In SheetName
Sheets(Name).Activate
'With Sheets(Name)
Do
If TypeName(Cells.Find("Index")) = "Range" Then
Cells.Find("Index", After:=ActiveCell).Activate
ActiveCell.Copy
ActiveCell.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Else
Exit Do
End If
Loop
'End With
Next
The Code below works when the sheet is activated. However
when the code does not work - "'With Sheets(Name)"
Any help in explaining this is greatly appreciated.
TIA.
Sub resetdata()
Dim SheetName(1) As String
SheetName(0) = "2004"
SheetName(1) = "2004Data"
For Each Name In SheetName
Sheets(Name).Activate
'With Sheets(Name)
Do
If TypeName(Cells.Find("Index")) = "Range" Then
Cells.Find("Index", After:=ActiveCell).Activate
ActiveCell.Copy
ActiveCell.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Else
Exit Do
End If
Loop
'End With
Next