ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   looping through worksheets (https://www.excelbanter.com/excel-programming/272153-looping-through-worksheets.html)

alex

looping through worksheets
 
I have problem looping through worksheets. I am getting
error 9. Please help.This is my code:
Sub copy2()
Dim update As Range
Dim cell As Range
Dim a As String
Dim i As Integer
Dim b As String
For i = 1 To 3
Set cell = Workbooks("0620.Xls").Sheets("d.o.").Range
("c27").Offset(0, 1)
a = Str(i)
b = "control_point" & a
Set update = Workbooks("0620.Xls").Sheets(b).Range("d26")
update.copy
cell.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Next i
End Sub


All times are GMT +1. The time now is 06:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com