M
March
I have VBA code below
With Workbooks("Book.xls").Worksheets("Sheet1")
.Range("C1:BO1").Copy
.Range(strPrevRange).PasteSpecial (xlPasteFormulasAndNumberFormats)
End With
Application.CutCopyMode = False
With Workbooks("Book.xls").Worksheets("Sheet1")
.Range("C4:BO4").Copy
.Range(strCurrentRange).PasteSpecial (xlPasteFormulasAndNumberFormats)
End With
Application.CutCopyMode = False
With Workbooks("Book.xls").Worksheets("Sheet1")
.Range(strPrevRange).Copy
.Range(strPrevRange).PasteSpecial (xlPasteValues)
End With
---------
With strCurrentRange and strPrevRange are the range of new address.
Range(C1:BO1) and (C4:BO4) contains formula
from the code above I code in ThisWorkbook in Private Sub Workbook_Open()
once its open should be run.
The problem to run the process is I cannot get the values in range(C1:BO1)
update before range(C1:BO1).copy then range(xx:xx).PasteSpecial
(xlPasteFormulasAndNumberFormats)
and range(C1:BO1).copy then range(xx:xx).PasteSpecial (xlPasteValues) at the
end
I try to have "Application.Wait Now + TimeValue("00:00:10")" in the begining
of the code .... I got the same result that the value not update before copy.
However, when I run the code line-by-line, everything seems to be updated ....
This I have no idea how to deal with it. Please give me suggestion.
Thanks
March
With Workbooks("Book.xls").Worksheets("Sheet1")
.Range("C1:BO1").Copy
.Range(strPrevRange).PasteSpecial (xlPasteFormulasAndNumberFormats)
End With
Application.CutCopyMode = False
With Workbooks("Book.xls").Worksheets("Sheet1")
.Range("C4:BO4").Copy
.Range(strCurrentRange).PasteSpecial (xlPasteFormulasAndNumberFormats)
End With
Application.CutCopyMode = False
With Workbooks("Book.xls").Worksheets("Sheet1")
.Range(strPrevRange).Copy
.Range(strPrevRange).PasteSpecial (xlPasteValues)
End With
---------
With strCurrentRange and strPrevRange are the range of new address.
Range(C1:BO1) and (C4:BO4) contains formula
from the code above I code in ThisWorkbook in Private Sub Workbook_Open()
once its open should be run.
The problem to run the process is I cannot get the values in range(C1:BO1)
update before range(C1:BO1).copy then range(xx:xx).PasteSpecial
(xlPasteFormulasAndNumberFormats)
and range(C1:BO1).copy then range(xx:xx).PasteSpecial (xlPasteValues) at the
end
I try to have "Application.Wait Now + TimeValue("00:00:10")" in the begining
of the code .... I got the same result that the value not update before copy.
However, when I run the code line-by-line, everything seems to be updated ....
This I have no idea how to deal with it. Please give me suggestion.
Thanks
March