esquiresurf
New Member
- Joined
- Mar 24, 2015
- Messages
- 9
Hi
I would like my macro to do the following:
- Go through each worksheet in a workbook
- Find a cell value that is in all worksheets
- Copy the cell that is two cells to the right
- Paste values into a Worksheet called Daily Net Movement
However the error I receive is: Object Variable or Withblock variable not set
Here is the code:
Rich (BB code):
Rich (BB code):
Rich (BB code):
Rich (BB code):
Sub Collect_Net_Movement()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim ws1 As Worksheet
Set ws1 =Worksheets("Daily Net Movement")
ws1.Select
i = 14
For Each ws In ThisWorkbook.Worksheets
'find cell with text "Agreed Collateral Move" andcopy cell 2 cells to the right
Cells.Find("Agreed Collateral Move").Select 'Errorreceived on this line
ActiveCell.Offset(0, 2).Copy
'paste values in worksheet("Daily Net Movement")starting from Cell E14
With ws1.Range("E" & i)
.PasteSpecialxlPasteValues
End With
i = i + 1
Next ws
Application.ScreenUpdating = True
End Sub
All worksheet names are different.
Any assistance in correcting this code would be greatlyappreciated.
Thank you