LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Copy/Paste in VBA Excel

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




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
copy & paste in excel Trish Excel Discussion (Misc queries) 1 December 10th 08 08:01 PM
Copy and Paste in Excel SFOLEY Excel Discussion (Misc queries) 1 February 13th 06 03:20 AM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM


All times are GMT +1. The time now is 09:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"