Thread: loop
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
philcud philcud is offline
external usenet poster
 
Posts: 34
Default loop

i have a loop statement where i want to loop through the values in the
range on the sheet "Lists" cells a2:a70 and set the value of "report
items location" cell a1 to this value, calculate, save as this value
and loop. i have so far:-

Sub loopthroughrangeandsave()
Dim nameofile As String
For Counter = 2 To 70
Set curCell = Worksheets("Lists").Cells(Counter, 3)
' Set curCell = Worksheets("Lists").Cells(Counter, 3)
curCell.Copy


Sheets("report items location").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False


Application.Calculate

Set nameofile = curCell

activebook.SaveAs Filename:=nameofile
'SaveAs (Filename)


Next Counter


End Sub


but this fails on the line
activebook.SaveAs Filename:=nameofile
'SaveAs (Filename)
saying object required?