Copy and close code
adapt the following code
in this I test column G , and if the value = 1 then I copy/paste values in
E:G in that row
Option Explicit
Sub CopyPaste()
Dim lastrow As Long
Dim cell As Range
Dim sheetnum As Long
lastrow = Range("E:G").SpecialCells(xlCellTypeLastCell).Row
For sheetnum = 2 To 4
With Worksheets("sheet" & sheetnum)
For Each cell In .Range(.Range("G1"), .Cells(lastrow, "G")).Cells
If cell.Value = 1 Then
With .Range(.Cells(cell.Row, "E"), .Cells(cell.Row, "G"))
.Value = .Value
End With
End If
Next
End With
Next
End Sub
"LiAD" wrote:
Hi,
I have a worksheet which uses an indirect formula to search through a series
of files/sheets based on an address to return a value from cell AE20. Once
the data has been copied for all the previous days I would like a copy/paste
values to occur to replace any of the values returned by the formula. In
AU10:AU381 there is a 1 or 0 for each row. 1 meaning that a copy/pastevalues
can be performed (decided by if the date is < today), and zero if i need to
keep the formulas.
Is it possible to have a copy/paste values code for only sheets 2-4 which
works when the file is closed to perform a copy paste values in cols AG-AU if
the value in AU=1?
Thanks
LiAD
|