Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Copy paste - Values - formula - Optimise

Hi have have code as below and I am looking to Optimise the same.. something
like..

sheets("calc").Range("B1:B200").Value=
sheets("IndBIDs").Range("A1:A200").Value

sheets("calc").Range("A1:A200") = sheets("calc").Range("A1:A200").Value

But range will be dynamic as per below code..

1st............

Sheets("IndBIDs").Select
Application.Goto Reference:="R1C1"
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("calc").Select
Application.Goto Reference:="R2C1"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False


2nd...........

Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Copy paste - Values - formula - Optimise

Hi

This should do it:

Dim TargetSh As Worksheet
Dim DestSh As Worksheet
Dim CopyCell As Range
Dim DestCell As Range

Set TargetSh = Sheets("IndBIDs")
Set DestSh = Sheets("calc")
With TargetSh
.Range("A1", .Range("A1").End(xlDown)).Copy
End With

DestSh.Range("A2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False


'2nd...........
With DestSh
Set CopyCell = .Range("A1") ' change cell as desired
End With
Set DestCell = Range(CopyCell, CopyCell.End(xlDown))
CopyCell.Copy
DestCell.PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False


DestCell.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Regards,
Per

"Kashyap" skrev i meddelelsen
...
Hi have have code as below and I am looking to Optimise the same..
something
like..

sheets("calc").Range("B1:B200").Value=
sheets("IndBIDs").Range("A1:A200").Value

sheets("calc").Range("A1:A200") = sheets("calc").Range("A1:A200").Value

But range will be dynamic as per below code..

1st............

Sheets("IndBIDs").Select
Application.Goto Reference:="R1C1"
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("calc").Select
Application.Goto Reference:="R2C1"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False


2nd...........

Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Copy paste - Values - formula - Optimise

Hi, I do not want to do copy | pastespecial | values.. I need to assign value
only..

"Per Jessen" wrote:

Hi

This should do it:

Dim TargetSh As Worksheet
Dim DestSh As Worksheet
Dim CopyCell As Range
Dim DestCell As Range

Set TargetSh = Sheets("IndBIDs")
Set DestSh = Sheets("calc")
With TargetSh
.Range("A1", .Range("A1").End(xlDown)).Copy
End With

DestSh.Range("A2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False


'2nd...........
With DestSh
Set CopyCell = .Range("A1") ' change cell as desired
End With
Set DestCell = Range(CopyCell, CopyCell.End(xlDown))
CopyCell.Copy
DestCell.PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False


DestCell.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Regards,
Per

"Kashyap" skrev i meddelelsen
...
Hi have have code as below and I am looking to Optimise the same..
something
like..

sheets("calc").Range("B1:B200").Value=
sheets("IndBIDs").Range("A1:A200").Value

sheets("calc").Range("A1:A200") = sheets("calc").Range("A1:A200").Value

But range will be dynamic as per below code..

1st............

Sheets("IndBIDs").Select
Application.Goto Reference:="R1C1"
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("calc").Select
Application.Goto Reference:="R2C1"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False


2nd...........

Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False



Reply
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
Copy and paste up to values in last row Scott Excel Discussion (Misc queries) 2 September 23rd 09 10:23 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
Copy/Paste Values briank Excel Programming 5 May 27th 05 05:20 PM
Urgent Help needed on! Copy and Paste a Formula as Values using a Loop statement Edward S Excel Programming 4 June 26th 04 10:01 PM
How do i compare values from two sheet and copy & paste if values match? rozb Excel Programming 0 March 5th 04 12:06 AM


All times are GMT +1. The time now is 07:25 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"