Hello Everyone,
I have this code that paste data to another worksheet:
Sub Fill_Click()
Dim bk As Workbook
Dim bSave As Boolean
Dim lRow As Long
' test to see if Destination.xls is already open
On Error Resume Next
Set bk = Workbooks("Destination.xls")
On Error GoTo 0
If bk Is Nothing Then
bSave = True
Set bk = Workbooks.Open("D:\MY DOCUMENTS\AUTOFILL\Destination.xls")
End If
' FILL DATA FROM SOURCE TO DESTINATION
With ThisWorkbook.Sheets("MyData")
bk.Worksheets("Sheet1").Range("J11").Value = .Range("AC409").Value
bk.Worksheets("Sheet1").Range("J12").Value = .Range("AC411").Value
bk.Worksheets("Sheet1").Range("J13").Value = .Range("AC407").Value
bk.Worksheets("Sheet2").Range("I10").Value = .Range("AC3").Value
bk.Worksheets("Sheet2").Range("I12").Value = .Range("AC17").Value
End With
With ThisWorkbook.Sheets("OTHER DATA")
bk.Worksheets("Sheet1").Range("I26").Value = .Range("F56").Value
bk.Worksheets("Sheet3").Range("I39").Value = .Range("F65").Value
bk.Worksheets("Sheet3").Range("I45").Value = .Range("F66").Value
End With
' if destination was originally closed, then save and close it
If bSave Then bk.Close Savechanges:=True
End Sub
This is my little problem. I want to clear specific or range of cells on destination worksheets before that code run. Example, i want to clear cells J11:J20, I23, I34:I35 on destination.xls "Sheet1", cells I10, I14:I19 on "Sheet2", and so on...
I know someone there have a solution for this little prob...
More Power!
Bookmarks